JSON Path
It pulls the one value specified by a path out of the JSON string arriving at JSON and outputs it. Use it as the partner that receives HTTP Request’s Body directly.
The path format
You dig into object keys with . and into arrays with [n].
syncedLyrics— a top-level key[0].syncedLyrics— a key on the first element of an arraydata.items[2].name— nested
Whitespace around the path is stripped before it is used. If you leave the path empty, the whole JSON comes out of Out as it is.
You can give the path either by writing it in the field on the node body or by feeding it into the Path port.
The three outputs
Out— if the value pulled out is a string, its contents. If it is an object or an array, it comes out as JSON text, so you can dig further with another JSON Path downstream. Numbers and booleans come out in their text notationNumber— the value itself for a number, 1 fortrueand 0 forfalsefor a boolean, and a string that can be read as a number also becomes a number. Anything else is 0Found— whether a value could be pulled out
All three are output only when the value differs from last time.
When nothing could be pulled out
In any of the following, Out becomes an empty string, Number becomes 0 and Found becomes false. You can check what happened in the small text on the node.
JSONis empty, or nothing but whitespace- A string arrived that cannot be read as JSON (the API returned an HTML error page, for example)
- The path format is invalid
- What the path points at does not exist, or the value is null
When a value could be pulled out, the display on the node changes to match the kind of that value.
Input ports
| Port ID | Type |
|---|---|
JSON | string |
Path | string |
Output ports
| Port ID | Type |
|---|---|
Out | string |
Number | float |
Found | bool |
Scriptable members
| Path | Type |
|---|---|
jsonInput | string |
pathInput | string |
currentPath | string |
Synapse Apps (scripting)
await synapse.modules.create({ type: "JsonPath" }) 
