Parsing responses from the new V2 API

Hi all,

I am currently migrating old data requests from the API v1 to the new GraphQL API v2. I am having trouble figuring out how to parse the resultant JSON using something like JQ. I want to take s board, then take the column titles as my data “names” and the item values as the values.

If anyone has tips on how to parse the json I would be appreciative. I have attached two example JSONs, the first being out.png which is the data I want to parse. The second is pipelineExample.png which is the format I want to obtain.

I would have attached the JSON files but the forums do not support json attachments.

Best,
Isaiah Fisher

Hi all,

quick update: I have got the correct JSON format parsing, however now each “value” such as timeline is stuck as:

"Timeline": "{\"from\":\"2019-07-03\",\"to\":\"2019-07-25\",\"changed_at\":\"2019-07-29T14:55:39.487Z\"}",

instead of:

"timeline": {
      "from": "2019-07-17",
      "to": "2019-07-26",
      "changed_at": "2019-07-23T20:13:58.253Z"
    }

Does anyone know if there is a way to convert this string representation down to a more suitable JSON style representation so that parsing can continue?

Best,
Isaiah Fisher

hey @isaiah_fisher,
you can use JSON.parse for the timeline value (and all other column values as they are all JSON strings).

Hi @Ayelet

Is this part of a specific programming language or how would I do this. Right now I am using a batch file and curl to make the query call, then hopefully using a batch file to process the query response into a nicely formatted JSON. If JSON.parse has a batch scripting language equivalent I could use that. Otherwise, I would love to know which language/method you would use to get the values.

Forgive me if I am misunderstanding your answer. I am still pretty new to REST and GraphQL.

Best,
Isaiah Fisher

JSON.parse is in javascript but has equivalent in most code languages.
I found this post about formatting JSON in bash scripts:

Hope this helps!

1 Like