name:"JPath Expression: Fetch of values from specific object",
input:JSON.stringify(JPATH_TEST_DATA),
expectedOutput:[
"\"Nigel Rees\"",
"\"Evelyn Waugh\"",
"\"Herman Melville\"",
"\"J. R. R. Tolkien\""
].join("\n"),
recipeConfig:[
{
"op":"JPath expression",
"args":["$.store.book[*].author","\n"]
}
],
},
{
name:"JPath Expression: Fetch of all values with matching key",
input:JSON.stringify(JPATH_TEST_DATA),
expectedOutput:[
"\"Sayings of the Century\"",
"\"Sword of Honour\"",
"\"Moby Dick\"",
"\"The Lord of the Rings\"",
"\"Financial Times\"",
"\"The Guardian\""
].join("\n"),
recipeConfig:[
{
"op":"JPath expression",
"args":["$..title","\n"]
}
],
},
{
name:"JPath Expression: All data in object",
input:JSON.stringify(JPATH_TEST_DATA),
expectedOutput:[
"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}]",
expectedOutput:"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}",
recipeConfig:[
{
"op":"JPath expression",
"args":["$..book[-1:]","\n"]
}
],
},
{
name:"JPath Expression: First 2 elements in array",
input:JSON.stringify(JPATH_TEST_DATA),
expectedOutput:[
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}"
].join("\n"),
recipeConfig:[
{
"op":"JPath expression",
"args":["$..book[:2]","\n"]
}
],
},
{
name:"JPath Expression: All elements in array with property",