JSON
JSON all things!
Last updated
Was this helpful?
JSON all things!
Last updated
Was this helpful?
BoxLang supports native JSON support via several key functions and some member functions.
BoxLang gives us the jsonSerialize()
function to convert any piece of data to its JSON representation ()
Pass in any complex or simple variable to the var
argument and JSON will be produced:
You can even use the toJSON()
member function:
By default BoxLang will keep the keys in a struct in their original casing in the resulting JSON document:
Just pass a JSON document, and off we go with native structs/arrays/dates/strings and booleans.
This function can also be used as a member function in any string literal:
The inverse of serialization is deserialization (). BoxLang gives you the jsonDeserialize()
function that will take a JSON document and produce native BoxLang data structures for you.
BoxLang has a function to test if the incoming string is valid JSON () or not: isJSON()