Alternate rbv_api.stringToJson()?

Posted by Wave Kasipat on 15-Aug-2016 02:31

I used rbv_api.stringToJson() to convert String from rbv_api.sendHttpGet() to JSON array of object in EVAL, And got one problem.

When String is too long, I got "Formula too long: 275865 chars, 102400 allowed (line #262) in formula".

 

I have changed MaxFormulaSize in shared.properties to increased allowed chars in formula, And it work.

But my data still growth and it will error again.

 

So, Is there other javascript function to convert string to JSON with no limit of character?

 

thank.

Kasipat

Posted by Shiva Duriseati on 19-Aug-2016 01:13

Hi Kasipat,

Yes if you return value is an object which needs conversion to String then you can use JSON.stringify ,whereas if your return value is a string and want to convert into JSON object then as you said JSON.parse can be used.

Regards,

Shiva

All Replies

Posted by Shiva Duriseati on 18-Aug-2016 01:17

Hi Kasipat,

Could you try below one?

JSON.stringify(eval("(" + str + ")"));

Here "str" is the string which is returned from rbv_api.sendHttpGet() API.

Regards,

Shiva

Posted by Wave Kasipat on 18-Aug-2016 23:37

Hi Shiva,

 

I tried JSON.stringify(eval("(" + str + ")")); , It didn't work.

But I found JSON.parse(str); that is invert of JSON.stringify and used it.

And it work like rbv_api.stringToJson() with no char limit.

 

Thanks,

Kasipat

Posted by Shiva Duriseati on 19-Aug-2016 01:13

Hi Kasipat,

Yes if you return value is an object which needs conversion to String then you can use JSON.stringify ,whereas if your return value is a string and want to convert into JSON object then as you said JSON.parse can be used.

Regards,

Shiva

This thread is closed