Six Stars

Parsing JSON with tExtractJSONFields

I have this JSON that I made up

{ "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 **bleep**",
        "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": [
			{ "EU":22.99},
			{ "US":72.3 },
			{ "BIH":5.80}
		]
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}

Is it possible that I can use tExtractJSONFields  to get every book in its own row ? How can I do that ?

My end goal the is to go through each of that row and get prices.

1 REPLY
Twelve Stars

Re: Parsing JSON with tExtractJSONFields

Yes, this is very possible.

Just set your "loop jsonPath query" to "$.store.book[*]" and then you can extract each of the entities within the book loop by simply placing the name exactly as it appears within quotes in the mapping section. For example....

 

"category"

"author"

"title"

"price"

 

 

Rilhia Solutions