Search code examples
jsonformatgoogle-cloud-dataprep

import json file in google dataprep


is there anyone here know how to import json file in google data prep? I can upload a json files there, but it can't create columns.

here is the screenshot:enter image description here

as you can see it displays all json into 1 column.

I did some research and looks to me that JSON should be supported with additional steps

here is the article: https://cloud.google.com/dataprep/docs/html/Supported-File-Formats_57344528

and here is the additional step article: https://cloud.google.com/dataprep/docs/html/Splitrows-Transform_57344654.

I did try to split rows but it is still not working. Is there any particular format of JSON I have to use?

would be nice if you could give me a simple example of json file that works as expected.

thanks.


Solution

  • Found the answer.

    example data:

    {"name":"jonSnow","age":21,"dob":"1988-01-01","tags":["a","b"],"address":{"postcode":3122,"state":"vic"}}
    {"name":"aom","age":21,"dob":"1988-02-01","tags":["c","d"],"address":{"postcode":3000,"state":"Vic"}}
    

    when it has been added as a dataset, these are the steps:(this has been by default suggested by dataprep)

    1. split rows.

      splitrows col: column1 on: '\n' quote: '\"' quoteEscapeChar: '\"'

    2. create column using un

      unnest col: column1 keys: 'name', 'age', 'dob', 'tags', 'address.postcode', 'address.state'

    From what I understand, google data prep will receive your json as a string. So it really depends on how you import the dataset.