JSONPath: Difference between revisions
(Created page with "== Go To == *Email rules: Extracting data *Creating and editing rules *Rules for creating tasks by email *Feature Description") |
No edit summary |
||
Line 1: | Line 1: | ||
mails sent to Planfix can be parsed using JSON. JavaScript Object Notation is a format for storing and exchanging information available as human-readable text. There are two main elements in a JSON object: the key and the value. | |||
==Example== | |||
{"city":"New York", "country":"United States"} | |||
keys — city and country; | |||
values — New York and United States | |||
Planfix can parse emails in this format and add the relevant data to infoblocks. The JsonPath library is used to do so. | |||
==Example== | |||
<div style="background-color:#f9f9f9; border:1px solid #ddd; padding:1em;"> | |||
An email is sent to Planfix with JSON: | |||
{ | |||
"firstName": "John", | |||
"lastName": "Smith", | |||
"address": { | |||
"streetAddress": "10 Main Street, Apartment 101", | |||
"city": "Pleasantville", | |||
"postalCode": 10101 | |||
}, | |||
"phoneNumbers": [ | |||
"812-123-1234", | |||
"916-123-4567" | |||
] | |||
} | |||
</p> | |||
</div> | |||
Let's say we need the following data from the JSON: | |||
{ | |||
"firstName": "John", | |||
"lastName": "Smith", | |||
"address": { | |||
"streetAddress": "10 Main Street, Apartment 101", | |||
"city": "Pleasantville", | |||
"postalCode": 10101 | |||
}, | |||
"phoneNumbers": [ | |||
"812-123-1234", | |||
"916-123-4567" | |||
] | |||
} | |||
We would configure the following rule for processing emails: | |||
== Go To == | == Go To == | ||
*[[Email rules: Extracting data]] | *[[Email rules: Extracting data]] |
Revision as of 03:45, 26 March 2021
mails sent to Planfix can be parsed using JSON. JavaScript Object Notation is a format for storing and exchanging information available as human-readable text. There are two main elements in a JSON object: the key and the value.
Example
{"city":"New York", "country":"United States"} keys — city and country; values — New York and United States Planfix can parse emails in this format and add the relevant data to infoblocks. The JsonPath library is used to do so.
Example
An email is sent to Planfix with JSON: { "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "10 Main Street, Apartment 101", "city": "Pleasantville", "postalCode": 10101 }, "phoneNumbers": [ "812-123-1234", "916-123-4567" ] }
Let's say we need the following data from the JSON: { "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "10 Main Street, Apartment 101", "city": "Pleasantville", "postalCode": 10101 }, "phoneNumbers": [ "812-123-1234", "916-123-4567" ] } We would configure the following rule for processing emails: