As you may or may not know, JSONPath is a query language for JSON, similar to XPath for XML. In Loopify, you can use JSONPath to map to a specific object in your JSON array.
- Add your Import block using an API call.
- Map using a JSON and add your JSON that includes an array of objects.
- The array of objects can be maped to a field or you can use the JSONPath icon
- By clicking the icon, you can then specify the exact value of your array that you want mapped
Note: if mapped succesfully or a mapping already exists, the {;} icon will turn green.
Example
Let's say you have a simple array that looks like this:
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "J.R.R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
},
"expensive": 10
}
Out of the 'book' array, you would want to specify (map) the second item. To do this, you click the {;} icon in the Loopify mapping modal and add the following [?(@.author=='J.R.R. Tolkien')].title in the text field to get the 'title' value for the array item where the author is 'J.R.R. Tolkien'.
This would list all titles whose author is J.R.R Tolkien. Since it's only one in our example, the item from the array is now specified and you can map it to a Loopify contact field.
Tip: You can check out more at the creator of JSONPath.
Thats about it! Still got questions? Reach us at support@loopify.com.
Comments
0 comments
Please sign in to leave a comment.