I have some JSON in a custom column field, I need ...
# advancedpdf
j
I have some JSON in a custom column field, I need to parse it. If I use ?eval it throws an unexpected error. Can't figure it out
r
JSON.parse(jsonString)
c
@raghav in freemarker?
j
sorry in freemarker
r
My bad.
m
From memory ?eval chokes on null. There is a new eval_json directive in Freemarker but I don't think it's available yet in the version NetSuites uses
r
j
message has been deleted
@michoel you're right, eval_json doesn't seem to work yet
@raghav I believe this is going from string to JSON, i'm trying to go from JSON to array
this is what's in my item column
r
This is a string right stored in a field in some record ? You will first have to parse the string and convert it to JSON? And then you will have your array of dictionaries which you can iterate?
j
it's possible that NS see's it as a string
because yes a user event script is generating it as JSON and then setting it into a freeform text field
w
I don't think you can do a outer square bracketed JSON like you example [ { }, { }, { } ] you need to convert it to: { translations: [ { } , { } ] } you outer brackets must be curly braces.
j
will try @wbermudo
@wbermudo
this is the JSON now, the second I run ?eval it gets an unexpected error
message has been deleted
even if i try ?eval something like this it throws the error
sorted it
must've been a blank value somewhere
it does work with [] on the outsides
👍🏽 1
w
glad you figure it out.