jsonpath

Extract several JSON objects at different depths with JayWay JSONPath

冷暖自知 提交于 2019-12-24 05:21:49
问题 Situation I have a JSON I'm trying to grab every element in an array that has some particular nested objects. The hard part is that some of these objects are nested at different depths. I'm using JayWay JsonPath https://github.com/json-path/JsonPath, and my code works exactly like https://jsonpath.herokuapp.com This is to use on our platform, https://dashdash.com - a spreadsheet with integrations for known web services (and your private APIs too). Particular case (testable) Consider the

Extract several JSON objects at different depths with JayWay JSONPath

久未见 提交于 2019-12-24 05:21:23
问题 Situation I have a JSON I'm trying to grab every element in an array that has some particular nested objects. The hard part is that some of these objects are nested at different depths. I'm using JayWay JsonPath https://github.com/json-path/JsonPath, and my code works exactly like https://jsonpath.herokuapp.com This is to use on our platform, https://dashdash.com - a spreadsheet with integrations for known web services (and your private APIs too). Particular case (testable) Consider the

Redshift COPY using JSONPath for missing array/fields

て烟熏妆下的殇ゞ 提交于 2019-12-24 01:23:54
问题 I am using the COPY command to load the JSON dataset from S3 to Redshift table. The data is getting loaded partially but it ignores records which has missing data(key-value/array) i.e. from the below example only the first record will get loaded. Query: COPY address from 's3://mybucket/address.json' credentials 'aws_access_key_id=XXXXXXX;aws_secret_access_key=XXXXXXX' maxerror as 250 json 's3:/mybucket/address_jsonpath.json'; My question is how can I load all the records from address.json

Can't apply concat function in WSO2 ESB CONFIGURATION with json-eval

谁说我不能喝 提交于 2019-12-23 23:17:39
问题 I'm trying to set this expression in order to obtain the output file name as a concat between the name of the city and the extention of the file: <?xml version="1.0" encoding="UTF-8"?> <sequence name="WriteFile_City" xmlns="http://ws.apache.org/ns/synapse"> <property expression="concat(json-eval($.city.name),'.xml')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/> <property name="OUT_ONLY" value="true"/> <send> <endpoint> <address

Exclude fields from JSON using JSONPath

我的未来我决定 提交于 2019-12-23 21:45:57
问题 I am getting a JSON response from REST service call and want to select only some of the fields from response. I am using JSONPath to filter out the fields. Below is the JSON example: { "store": { "book": [{ "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

Apply JSONPath filter to field with space

你离开我真会死。 提交于 2019-12-23 16:34:41
问题 I'm trying to use JSONPath (https://github.com/jayway/JsonPath) to search a document which has spaces in the field names: { "model": { "Details": { "Nospace": "New today", "Random nonsense": "New today" } } } I'm testing using the evaluator at http://jsonpath.herokuapp.com/ This works: $.model.Details[?(@.Nospace== 'New today')] But this does not: $.model.Details[?(@.'Random nonsense'== 'New today')] This does but is missing the filter expression: $.model.Details['Random nonsense'] So it

Pick the Nth item from a filter expression in JSONPath

℡╲_俬逩灬. 提交于 2019-12-23 09:26:25
问题 I've been trying to filter a specific element in my JSON using JSONPath and then to choose only the 1st item in the returned array of results. My baisc JSONPath looks something like this: $.store.book[?(@.category==fiction)].price I want to add this [0] filter like this: $.store.book[?(@.category==fiction)][0].price but it doesn't return results or if I put the [0] after the last "price" I get this error: Filter: [0]['price'] can only be applied to arrays I've been searching and couldn't find

How to get cluster id using kubectl command

拈花ヽ惹草 提交于 2019-12-23 06:16:10
问题 I need cluster-id using kubectl command. root@vagrant-xenial64:~# kubectl get cm cluster-info -n kube-system -o jsonpath='{.data.cluster-config\.json}' { "cluster_id": "xxx", "cluster_name": "prod-yyy-mmm", "cluster_type": "rrr", "cluster_pay_tier": "vvv", "datacenter": "cse", "account_id": "456777", "created": "2018-06-32323dffdf:35:48+0000" } I need cluster-id of this particular json root@vagrant-xenial64:~# kubectl get cm cluster-info -n kube-system -o jsonpath='{.data.cluster-config\.json

Make object key a value in the equivalent sub-object

不羁岁月 提交于 2019-12-23 04:44:07
问题 I have a complex object where the key of each object property should actually be a value. So, I am trying to convert this: { "2019-04-24T00:00:00Z": { "one": 185, }, "2019-04-25T00:00:00Z": { "one": 207, } } to this: { { "date": "2019-04-24T00:00:00Z", "one": 185, }, { "date": "2019-04-25T00:00:00Z", "one": 207, } } I have pasted a snippet with an attempt. var obj2 = {"all":[{"branches":[{"branchname":"NAN","mains":[{"mainName":"FirstOne","plName":[{"metrics":{"2019-04-24T00:00:00Z":{"one"

Parse JSON in Mule 3.2 Flow

妖精的绣舞 提交于 2019-12-23 04:37:33
问题 If I have the following JSON [ { "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 } ] I can get the