1. SHAMEEM KAKKAD
  2. PowerBuilder
  3. Tuesday, 23 August 2022 03:12 AM UTC

Hi,

How can read this Json file with Jsonpaser ?. Anybody can help me ?

{
"Remittance": {
"Header": {
"SenderID": "AAAAA",
"ReceiverID": "BBBBBB",
"TransactionDate": "02/08/2022 01:33",
"RecordCount": 2,
"DispositionFlag": "PRODUCTION",
"PayerID": "RRRRRR"
},
"Claim": [
{
"ID": "11111111",
"IDPayer": "33333",
"ProviderID": "4444",
"DenialCode": "",
"PaymentReference": "555555555555",
"DateSettlement": "29/07/2022 00:00",
"Encounter": {
"FacilityID": "555555"
},
"Activity": [
{
"ID": "1111",
"Start": "14/05/2022 19:34",
"Type": "8",
"Code": "9.01",
"Quantity": 1,
"Net": 0,
"List": 0,
"Clinician": "XXXXXXX",
"Gross": 0,
"PatientShare": 0,
"ActivityPenalty": "",
"PaymentAmount": 0
},
{
"ID": "22222",
"Start": "14/05/2022 19:34",
"Type": "3",
"Code": "6666",
"Quantity": 1,
"Net": 6.6,
"List": 6.6,
"Clinician": "XXXXXX",
"Gross": 6.6,
"PatientShare": 0,
"ActivityPenalty": "",
"PaymentAmount": 6.6
},
{
"ID": "33333",
"Start": "14/05/2022 19:34",
"Type": "3",
"Code": "7777777",
"Quantity": 1,
"Net": 7.7,
"List": 7.7,
"Clinician": "XXXXXX",
"Gross": 7.7,
"PatientShare": 0,
"ActivityPenalty": "",
"PaymentAmount": 7.7
},
{
"ID": "444444",
"Start": "14/05/2022 19:34",
"Type": "3",
"Code": "8888888",
"Quantity": 1,
"Net": 16.5,
"List": 16.5,
"Clinician": "XXXXXXX",
"Gross": 16.5,
"PatientShare": 0,
"ActivityPenalty": "",
"PaymentAmount": 16.5
}
]
},
{
"ID": "222222222222",
"IDPayer": "3333333",
"ProviderID": "444444",
"DenialCode": "",
"PaymentReference": "555555555555555",
"DateSettlement": "29/07/2022 00:00",
"Encounter": {
"FacilityID": "7666"
},
"Activity": [
{
"ID": "55555555",
"Start": "24/05/2022 00:00",
"Type": "8",
"Code": "9999999",
"Quantity": 1,
"Net": 28,
"List": 28,
"Clinician": "XXXXXX",
"Gross": 35,
"PatientShare": 7,
"ActivityPenalty": "",
"PaymentAmount": 28
}
]
}
]
}
}

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 23 August 2022 06:27 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi,

The best way to parse a JSON is depending on how much you know about the structure.

If you know the structure it is easy. Here a starting example:

JSONParser lnv_JsonParser
long ll_RootObject, ll_Remittance, ll_header, ll_claim, ll_index, ll_ChildCount

lnv_JsonParser = CREATE JSONParser
lnv_JsonParser.LoadFile("YourJSONFile.json")
ll_RootObject = lnv_JsonParser.GetRootItem() // Root

// Remittance
ll_Remittance = lnv_JsonParser.GetItemObject (ll_RootObject, "Remittance")

// Header
ll_header = lnv_JsonParser.GetItemObject (ll_Remittance, "Header")
MessageBox ("Header->SenderID", lnv_JsonParser.GetItemString (ll_header, "SenderID"))

// Claim
ll_claim = lnv_JsonParser.GetItemArray (ll_Remittance, "Claim")

ll_ChildCount = lnv_JsonParser.GetChildCount(ll_claim)
for ll_Index = 1 to ll_ChildCount
    MessageBox ("Claim[" + string (ll_Index) + "]->ID", lnv_JsonParser.GetItemString (lnv_JsonParser.GetChildItem(ll_claim, ll_index), "ID"))
next

destroy lnv_JsonParser

 

If you don't know the structure you have to use functions like GetChildCount, GetChildItem, GetItemType, ... to dynamically parse. You can find examples in the help file.

 

HTH,

René

 

Comment
  1. SHAMEEM KAKKAD
  2. Tuesday, 23 August 2022 07:09 AM UTC
Many thanks sir for your response.

I am very poor in Json.

Sir, How can take Activity ?

When I am giving like this ll_activity = lnv_JsonParser.GetItemArray (ll_Remittance, "Activity"), coming -1.
  1. Helpful
  1. René Ullrich
  2. Tuesday, 23 August 2022 07:19 AM UTC
Activity is a child of a Claim entry.

Get the Handle of the Claim entry , e.g.

ll_claimitem = lnv_JsonParser.GetChildItem(ll_claim, ll_index)



Then access the Activity-Array

ll_activity = lnv_JsonParser.GetItemArray (ll_claimitem, "Activity")



After that you can run through the array like in example with the Claim-Array.



  1. Helpful 1
  1. SHAMEEM KAKKAD
  2. Tuesday, 23 August 2022 07:41 AM UTC
Ooook.... Many Thanks sir.....
  1. Helpful
There are no comments made yet.
Ludwin Feiten Accepted Answer Pending Moderation
  1. Tuesday, 23 August 2022 09:38 AM UTC
  2. PowerBuilder
  3. # 1

Hi Shameem,
I suggest that you user a JSON Viewer (I use the Notepad++ plugin) to get a knowledge of your JSON's structure.
That makes it easy to navigate.
KR, Ludwin

 

Comment
  1. SHAMEEM KAKKAD
  2. Thursday, 25 August 2022 06:46 AM UTC
Thanks
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.