Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: data to delete in multi level json string

  1. #1
    Join Date
    Aug 2015
    Posts
    310

    Default data to delete in multi level json string

    Hi

    Could you please help on how to delete string in json. below is the my sample example.

    (pdi 7.1 , java 1.7 , MySQL database)

    i want to delete second value i.e. comments{1}. could you please tell me some step or procedure to delete in JSON. I verified it google and i got json_replace function but it is not able to delete automatic process.

    We need to delete junk data in thousands so please help on this.

    [{"comments": [{"id": 1, "comments": "Int", "entityId": 10327, "createdBy": 1162, "updatedBy": 1162, "entityName": "Par", "Type": "Int", "Date": "07-19-2016 07:46:43", "Date": "07-19-2016 07:46:43", "User": "ADMIN", "User": "ADMIN"}, {"id": 2, "comments": "Ext", "entityId": 10327, "createdBy": 1162, "updatedBy": 1162, "entityName": "Par", "Type": "Ext", "Date": "07-19-2016 07:46:43", "Date": "07-19-2016 07:46:43", "User": "ADMIN", "User": "ADMIN"} ]}]

    Thank you

  2. #2
    Join Date
    Apr 2008
    Posts
    4,671

    Default

    Convert your JSON to standard PDI rows
    Then filter your rows by Type=Ext to allow external rows to continue through
    Write your output as JSON

  3. #3
    Join Date
    Aug 2015
    Posts
    310

    Default

    Hi Gutlez,

    Sorry my bad, i am not able to understand exactly. could you please elaborate little bit more with example if possible for you.

    Thank you

  4. #4
    Join Date
    Aug 2015
    Posts
    310

    Default

    Hi gutlez,

    We are having hundreds of sub strings\arrays\objects in one string. one can be type int and other will be ext like this.

    in multilevel string we are not able to identify exactly which type we need to delete it.

    could you please able to help on SQL or pdi step if there is any process to delete json

    Thank you for your support.

  5. #5
    Join Date
    Apr 2008
    Posts
    4,671

    Default

    You have to convert your JSON to standard rows. (JSON Input Step) - You may need to link a few of these together to get standardized rows.
    Then you can filter out the rows that don't belong (Filter Rows)
    Then you can then write out your JSON (JSON Output)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2017 Pentaho Corporation. All Rights Reserved.