Please note:this document is a work in progress.
JSON Kit
This kit contains the following nodes:
schemish
Converts a given JSON schema to Schemish
validateJson
Validates given JSON against a given JSON Schema.
jsonata
Use this node to execute JSONata expressions. JSONata is a versatile JSON query language.
Example
If we send the following inputs to jsonata
:
{
"expression": "$join(items.snippet, '\n')",
"json": {
"items": [
{
"snippet": "Question: How old is planet Earth?"
},
{
"snippet": "Thought: I wonder how old planet Earth is?"
}
]
}
}
We will get this output:
{
"result": "Question: How old is planet Earth?\nThought: I wonder how old planet Earth is?"
}
Inputs
expression
-- required, a string that contains the JSONata expression to be executed.raw
-- an optional boolean that specifies whether the result of the expression should be passed as-is (true
), or it should be passed as theresult
output property (false
, default).json
-- an optional JSON object that will be used as the context for the expression. Ifjson
is not specified, the node will use the input property bag (minusexpression
andraw
) as the context.
Outputs:
result
-- the result of the expression, unlessraw
istrue
. In the latter case, the result is passed as-is.
Implementation:
xmlToJson
node
The Use this node to convert XML to JSON. Most nodes in the starter kit are designed to work with JSON, so this node is useful when you have XML data.
This nodes takes one required xml
property, which it treats as XML and converts to it to JSON as the json
output property. The format of JSON follows the alt-json
convention that is described in https://developers.google.com/gdata/docs/json.
Example
If we send the following inputs to xml-to-json
:
{
"xml": "<root><question>How old is planet Earth?</question><thought>I wonder how old planet Earth is?</thought></root>"
}
We will get this output:
{
"json": {
"root": {
"question": { "$t": "How old is planet Earth?" },
"thought": { "$t": "I wonder how old planet Earth is?" }
}
}
}
Inputs:
xml
- required, must contain a string that represents XML.
Outputs:
json
- the result of converting XML to JSON.