Forum Discussion
Komag
10 years agoRoku Guru
It may not work if there are types of values it doesn't like:
The main thing is all the values can only be Booleans, Integers, Floats, Strings, Arrays, and Associative Arrays. No Function names allowed for one thing, and perhaps other things as well. So maybe this approach won't work in your case.
When I use it I don't use the flag, just FormatJson(myThing), not sure how that flag works anyway.
You might try:
print "firststr Type is " type(firststr)
7.20 FormatJson(json as Object, flags = 0 as Integer) as String
Formats an Associative Array as a JSON string.
Data types supported are booleans, integer and floating point numbers, strings, roArray, and roAssociativeArray objects.
An error will be returned if arrays/associative arrays are nested more than 256 levels deep.
If an error occurs an empty string will be returned.
Normally non-ASCII characters are escaped in the output string as "\uXXXX" where XXXX is the hexadecimal representation of the Unicode character value. If flags=1, non-ASCII characters are not escaped.
The main thing is all the values can only be Booleans, Integers, Floats, Strings, Arrays, and Associative Arrays. No Function names allowed for one thing, and perhaps other things as well. So maybe this approach won't work in your case.
When I use it I don't use the flag, just FormatJson(myThing), not sure how that flag works anyway.
You might try:
print "firststr Type is " type(firststr)