Skip to main content
Solved

Basic JSON to tabular format. I can't work out how to take contents of an array and map to fields.

  • November 26, 2020
  • 1 reply
  • 19 views

I am new to this and learning but...

I have a JSON object and am trying to extract the attributes to load to PostGreSQL and I am hitting my head against a wall.

 

The format of the JSON is generally as so:

 

{
    model: 1,
    version: 2,
    content: [
        {
            x=1,
            y=2
        },{
            x=3,
            y=4
        }
    ]
}
 

I want to output something along the lines of:

model, version,   x,    y

1,            2,                1,   2

1,            2,                3,   4

 

For the life of ne I cannot work it out, to me the documentation and step by steps are not clear. 

I am using a standard JSON reader. Whatever I try, flattener, fragmentation, I cannot opreate on the content.

I had an instance where I managed to get all extracted using an extractor but this would populate the attributes for each item in the content array and concat together to look like this:

model, version,   x,    y

11,            22,          13,  24

 

The real JSON is a lot more complicated but at this very basic level, I am still not there.

Best answer by jdh

Assuming actual valid json (which the above sample isn't for a couple of reasons) you can use an JSONExtractor followed by a JSONFragmenter to get the desired output.

 

json

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • Best Answer
  • November 26, 2020

Assuming actual valid json (which the above sample isn't for a couple of reasons) you can use an JSONExtractor followed by a JSONFragmenter to get the desired output.

 

json