- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 07:32 AM
Hi,
I have String value which i want to convert as Object.
string = "user firstname" : "first name", "user lastname" :"last name", "user fullname" :"full name"
I want to convert this string into an object. Challenge is we may lot many values in String field which we are not sure so how to set them into 1 object dynamically
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 07:38 AM
Hi Shaik,
that seems to me like a json object;
store that in json rather than string
var jsonObj = {"user firstname":"first name","user lastname":"last name","user fullname":"full name"};
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 07:40 AM
Ankur,
Actualy we have a field that contains values as shown below, for JSON i think we need to start with '{' & end with '}' but the input we get the as shown below:
string = "user firstname" : "first name", "user lastname" :"last name", "user fullname" :"full name"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 07:50 AM
Hi,
So then add it in? How are you getting this information? You can script to add that to the front and end.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 07:51 AM
Hi Shaik,
so you can easily add starting and ending curly bracket and rest part is already having json format
what is the purpose of that field? is it just used for storing
if yes then you can have name value type of field which will internally store data as json string
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader