Parse Json API response in Json Tool

Confluence User - 13 Sep, 2021

How would I setup the JSON Tool to capture:  Puts values ContractSymbol, strike and currency when I receive the below compacted result of my API call??

I have tried with this, but no luck:

{

  • "optionChain":{
    • "result":[
      1. {
        • "underlyingSymbol":"AAPL",
        • "expirationDates":,
        • "strikes":,
        • "hasMiniOptions":false,
        • "quote":,
        • "options":[
          1. {
            • "expirationDate":1631836800,
            • "hasMiniOptions":false,
            • "calls":,
            • "puts":[
              1. {
                • "contractSymbol":"AAPL210917P00027500",
                • "strike":27.5,
                • "currency":"USD",
                • "lastPrice":0.01,
                • "change":0,
                • "percentChange":0,
                • "volume":20,
                • "openInterest":2614,
                • "bid":0,
                • "ask":0.01,
                • "contractSize":"REGULAR",
                • "expiration":1631836800,
                • "lastTradeDate":1631303338,
                • "impliedVolatility":4.500004375,
                • "inTheMoney":false
                },
json;jsontool

3


15 Sep, 2021
confluenceUser
confluenceUser

Hi, from the response it's not clear which data is repeated. Assuming the "puts" is repeated, perhaps you could try using "optionChain.result[0].options[0].puts" as the Base JSON Object, and just "contractSymbol, "strike" and "currency" in the field mapping.

15 Sep, 2021
confluenceUser
1
confluenceUser

Hello,

Perhaps you can try out this plugin from JogetOSS Github page, called the Enhanced JSON ToolThis plugin was created to solve use cases where we need to format the JSON response of a JSON API call before storing data into a form or workflow variable. The configurations are exactly similar to the default bundled JSON Tool in Joget, just with an additional optional property to write bean shell script to format/modify the JSON response.

Its related KB and sample app w/ plugin is also here: Enhanced JSON Tool Plugin

Hope this helps!

16 Sep, 2021
confluenceUser
confluenceUser

Perfect.. thanks for the response. Will check it out

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print