- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 02:29 AM
Trying below script but the JSON only prints [object object]. What is the mistake here.
if (gr.isValidRecord()) {
result.u_class = gr.u_env_class;
result.u_status = gr.install_status;
}
return JSON.stringify(result);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 02:32 AM
Hi Rupal,
gr.field_name returns the object. It's better to convert it to string while saving it in JSON.
if (gr.isValidRecord()) {
result.u_class = gr.u_env_class.toString();
result.u_status = gr.install_status.toString();
}
return JSON.stringify(result);
Please mark correct/helpful if applicable.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 03:24 AM
Hi,
can you share your complete script?
You are already using JSON.stringify() so it should return a json string
Regards
Ankur