Forum Post: Re: How To Parse 3 Or More Level Of Json Using Read-json?

Status
Not open for further replies.
D

Dinesh

Guest
Thanks Peter. the JsonObject parser (ObjectModelParser) worked well. From: Peter Judge [mailto:bounce-pjudge@community.progress.com] Sent: Wednesday, August 19, 2015 6:41 PM To: TU.OE.Development@community.progress.com Subject: RE: [Technical Users - OE Development] How to parse 3 or more level of json using read-json? RE: How to parse 3 or more level of json using read-json? Reply by Peter Judge My question is - how I can parse the original json without any modification. you can see that I converted position from a complex string to an empty one. but the requirement is to access it as complex string. I don't believe this is possible using READ-JSON(). If you are on OE 11.0+ then you can use the JsonObject parser (ObjectModelParser) which will read any valid JSON. From: Dinesh [ mailto:bounce-dkushwah@community.progress.com ] Sent: Wednesday, 19 August, 2015 09:06 To: TU.OE.Development@community.progress.com Subject: [Technical Users - OE Development] How to parse 3 or more level of json using read-json? How to parse 3 or more level of json using read-json? Thread created by Dinesh I have a json file as below. ---------------- { "elements":[ { "type":"Campaign", "currentStatus":"Draft", "id":"154", "createdAt":"1269971107", "createdBy":"11", "depth":"partial", "description":"kp test", "folderId":"4035", "name":"TEST_Kandler", "updatedAt":"1430494658", "updatedBy":"919", "elements":[ { "type":"CampaignEmail", "id":"640", "position":{ "type":"Position", "x":"20", "y":"20" }, "contactCount":"0", "emailId":"4463", "isAllowingResend":"false", "isAllowingSentToUnsubscribe":"false", "sendTimePeriod":"sendAllEmailAtOnce" }, { "type":"CampaignEmail", "id":"641", "position":{ "type":"Position", "x":"20", "y":"95" }, "contactCount":"0", "emailId":"4465", "isAllowingResend":"false", "isAllowingSentToUnsubscribe":"false", "sendTimePeriod":"sendAllEmailAtOnce" }, { "type":"CampaignForm", "id":"642", "position":{ "type":"Position", "x":"20", "y":"170" }, "formId":"20" }, { "type":"CampaignForm", "id":"643", "position":{ "type":"Position", "x":"20", "y":"245" }, "formId":"112" } ], "isMemberAllowedReEntry":"false", "isReadOnly":"true" }, { "type":"Campaign", "currentStatus":"Draft", "id":"264", "createdAt":"1273254485", "depth":"partial", "description":"Banner Ad on info-mgmt.com\u000aMedium rectangle (300x250) and Leaderboard (728x90) to provide 100,000 impressions from 1\/25\/10 through 2\/28\/10.\u000aAlso included as part of package is one deployment in Information Management Daily E-Newsletter to 80,000 opt-in subscribers.\u000aAd promotes the bulk load functionality of the Connect product and click through will take visitor to an abstract of the webcast and registration page to download the webcast archive. Lead info will be captured from the registration page. \u000aWe anticipate .3% (.003) clickthroughs. \u000aAll who download the archive will receive a follow up email with a call to action to download 15-day trial.", "folderId":"4040", "name":"10Q1_DC_NA_BanAdInfoMgmt_BLWeb_cjb", "updatedAt":"1273254485", "actualCost":"12000.00", "budgetedCost":"12000.00", "crmId":"70130000000KipD", "elements":[ { "type":"CampaignForm", "id":"645", "position":{ "type":"Position", "x":"20", "y":"20" }, "formId":"20" } ], "endAt":"1296795600", "fieldValues":[ { "type":"FieldValue", "id":"4", "value":"Information Management.com\/Source Media" }, { "type":"FieldValue", "id":"5", "value":"" }, { "type":"FieldValue", "id":"2", "value":"DataDirect On Prem" }, { "type":"FieldValue", "id":"1", "value":"Banner\/advertisement::Event" }, { "type":"FieldValue", "id":"9", "value":"Online Ad - 3rd Party" }, { "type":"FieldValue", "id":"13", "value":"Horizontal" }, { "type":"FieldValue", "id":"17", "value":"Evelyn Swaim" }, { "type":"FieldValue", "id":"18", "value":"2010-01-22 00:00:00.000" }, { "type":"FieldValue", "id":"23", "value":"Canada::USA" }, { "type":"FieldValue", "id":"27", "value":"Data Integration" }, { "type":"FieldValue", "id":"31", "value":"Completed" }, { "type":"FieldValue", "id":"33", "value":"00530000002FAaF" }, { "type":"FieldValue", "id":"38", "value":"Q1" }, { "type":"FieldValue", "id":"40", "value":"0.0000" }, { "type":"FieldValue", "id":"41", "value":"15.0000" }, { "type":"FieldValue", "id":"42", "value":"Connie Broich" }, { "type":"FieldValue", "id":"43", "value":"Bulk Load Webinar Archive" }, { "type":"FieldValue", "id":"50", "value":"" }, { "type":"FieldValue", "id":"51", "value":"" }, { "type":"FieldValue", "id":"54", "value":"" }, { "type":"FieldValue", "id":"61", "value":"" }, { "type":"FieldValue", "id":"71", "value":"" }, { "type":"FieldValue", "id":"72", "value":"" }, { "type":"FieldValue", "id":"73", "value":"" }, { "type":"FieldValue", "id":"74", "value":"" }, { "type":"FieldValue", "id":"75", "value":"" }, { "type":"FieldValue", "id":"76", "value":"" }, { "type":"FieldValue", "id":"77", "value":"" }, { "type":"FieldValue", "id":"78", "value":"2010" }, { "type":"FieldValue", "id":"79", "value":"AMER" }, { "type":"FieldValue", "id":"80", "value":"NA" }, { "type":"FieldValue", "id":"81", "value":"NA_Data Connectivity" }, { "type":"FieldValue", "id":"62", "value":"" }, { "type":"FieldValue", "id":"63", "value":"" }, { "type":"FieldValue", "id":"64", "value":"" }, { "type":"FieldValue", "id":"65", "value":"" }, { "type":"FieldValue", "id":"66", "value":"" }, { "type":"FieldValue", "id":"68", "value":"" } ], "isMemberAllowedReEntry":"false", "isReadOnly":"true", "product":"", "region":"", "startAt":"1264395600" } ], "page":1, "pageSize":2, "total":5832 } ----------------- this give error when I try to parse it using json-read method. after some modification it works. after modification file looks as below.

Continue reading...
 
Status
Not open for further replies.
Top