JSON().encode in scoped app script includes

uma17
Tera Guru

Hi All

new JSON().encode is not in scoped app script include, can anyone suggest any other alternative for the same.

Thanks,

Uma

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Uma,



Here is the alternative. you need to use the global.JSON()



Try the below one and let me know the outcome.


var sampleObj = {


        color: "blue",


        height: "tall"


};


var sampleJSON = new global.JSON().encode(sampleObj);



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Harsh Vardhan
Giga Patron

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Uma,



Here is the alternative. you need to use the global.JSON()



Try the below one and let me know the outcome.


var sampleObj = {


        color: "blue",


        height: "tall"


};


var sampleJSON = new global.JSON().encode(sampleObj);



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Harsh Vardhan
Giga Patron

did i reply something different ?