JSONtoJSONSetElement
Convert JSON into a JSONSetElement calculation
Be the first to rate this function Log in to vote
Jason Wood - Show more from this author
Define Database https://www.definedatabase.com |
/* $json =
{
"string": "Hello, world!",
"number": 42,
"boolean": true,
"nullValue": null,
"array": [1, "two", false, null, {"nestedObject": "insideArray"}],
"object": {
"level1Key": "Level 1 value",
"nestedObject": {
"level2Key": 3.14,
"anotherNestedObject": {
"level3Key": {
"deepBoolean": false,
"deepArray": [true, null, {"deepestKey": "Deep inside"}]
}
}
}
}
}
*/
[ "array[0]" ; 1 ; JSONNumber ];
[ "array[1]" ; "two" ; JSONString ];
[ "array[2]" ; 0 ; JSONBoolean ];
[ "array[3]" ; "" ; JSONNull ];
[ "array[4].nestedObject" ; "insideArray" ; JSONString ];
[ "boolean" ; 1 ; JSONBoolean ];
[ "nullValue" ; "" ; JSONNull ];
[ "number" ; 42 ; JSONNumber ];
[ "object.level1Key" ; "Level 1 value" ; JSONString ];
[ "object.nestedObject.anotherNestedObject.level3Key.deepArray[0]" ; 1 ; JSONBoolean ];
[ "object.nestedObject.anotherNestedObject.level3Key.deepArray[1]" ; "" ; JSONNull ];
[ "object.nestedObject.anotherNestedObject.level3Key.deepArray[2].deepestKey" ; "Deep inside" ; JSONString ];
[ "object.nestedObject.anotherNestedObject.level3Key.deepBoolean" ; 0 ; JSONBoolean ];
[ "object.nestedObject.level2Key" ; 3.14 ; JSONNumber ];
[ "string" ; "Hello, world!" ; JSONString ]
)
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
The intended use is as a developer tool, for situations where you have sample JSON and need to create a JSONSetElement calculation to create a similar JSON object.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.