Below Code is creating property name -> exp_vfpsafe_ instead of exp whereas JSON does not contain exp_vfpsafe_
Code:
Close All
TEXT TO Json
{"data":{"exp":[{"inv":[{"val":156420,"itms":[{"csamt":0,"rt":0,"txval":156420,"iamt":0}],
"flag":"N","sbnum":"3206654","idt":"29-07-2022","sbdt":"01-08-2022","inum":"HMEI01",
"chksum":"aa9b7668f49a3f0f0d1d9354eb07afa77447c2fc38d23703a1656894d1d8da67","sbpcode":"INAMD4"}],
"exp_typ":"WOPAY"}]},"status_cd":"1","status_desc":"GSTR request succeeds",
"header":{"gst_username":"hariommanuf","state_cd":"02","ip_address":"192.168.0.1",
"txn":"f2f56579fef545cdad7898ac2cfe3d4e","client_id":"GSP2c426d19-739c-4ca2-9681-27b2584d09df",
"client_secret":"GSP5b0a2385-ac74-400f-9c19-fc365a32e244","ret_period":"072022","gstin":"02AABTH0219D1ZK"}}
ENDTEXT
jsonv = '['+Alltrim(json)+']'
Create Cursor Exp(exp_type c(5),inum c(20),idt c(10),Val N(16,2),sbpcode c(6),;
sbnum c(7),sbdt c(10),diff_percent N(5,2),rt N(6,2),txval N(14,2),;
iamt N(14,2),csamt N(14,2),json m(4),brgstin c(15),taxperiod c(15),;
z N(2),idate d(8),pkey N(6),fp c(6),portal l(1),gkey N(7),;
taxyear N(4),hsn N(8))
Set Procedure To d:\ERP\Utilities\Gst\nfJson-Master\nfJson\nfjsonread.prg
oJSON = nfjsonread(jsonv)
Local i,rowv
tnLevel = 0
For Each Gstr1Crit In oJSON.Array
tnLevel = Evl(tnLevel, 0)
Local lnI, lvMember, laMembers[1]
For lnI=1 To Amembers(laMembers,Gstr1Crit )
lvMember = Getpem(Gstr1Crit,laMembers[lnI])
If Vartype(lvMember)="O" And Capt(laMembers[lnI]) = 'DATA'
For Each Expv In lvMember.Exp
For Each invoicev In Expv.Inv
For Each ItemDtl In invoicev.Itms
Select Exp
Append Blank
Gather Name lvMember
Gather Name Ctinv
Gather Name invoicev
Gather Name ItemDtl
Browse Width 15
Endfor
Endfor
Endfor
Endif
Endfor
Endfor