- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 08:41 AM
Hi,
I am trying to read the table data using GlideRecord in the jelly script.GlideRecord query gives us data as in string format but I have one field in the form that holds the data as follows:
[{"x":"y"},{"a":"b"}]
<g:evaluate var="jvar_gr" object="true">
var gr = new GlideRecord("x_14768_catalyst_bot_library");
gr.addQuery("bot_id", "test_380ee1a0");
gr.query();
gr;
</g:evaluate>
<j:while test="${jvar_gr.next()}" >
<p>${jvar_gr.getValue('params')}</p>
</j:while>
jvar_gr.getValue('params') returns data as in string but I want to convert it into JSON and loop the data and read the value of x and a.
Can someone please help me to resolve the issue.
Complete Code:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form>
<g:evaluate var="jvar_gr" object="true">
var gr = new GlideRecord("x_14768_catalyst_bot_library");
gr.addQuery("bot_id", "test_380ee1a0");
gr.query();
gr;
</g:evaluate>
<j:while test="${jvar_gr.next()}" >
<p>${jvar_gr.getValue('params')}</p>
<j:forEach var="jvar_param" items="${jvar_gr.getValue('params')}">
------ READ THE VALUES of A and X----
</j:forEach>
</j:while>
</g:ui_form>
</j:jelly>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 08:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 11:35 AM
Glad to help, Vimal!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 06:21 PM
Hope this article helps.
https://codeblogmoney.com/convert-string-to-json-using-javascript/
It converts JSON string to javascript object.
Thanks,
James