koemaeda / abap-json Goto Github PK
View Code? Open in Web Editor NEWJSON encoder/parser in ABAP
License: MIT License
JSON encoder/parser in ABAP
License: MIT License
Hello Koemaeda!
I ran into an issue with decoding a JSON object using your great ZCL_JSON class. (Thank you so much for making that one available!!!)
My JSON object is like this:
{
"totalRecordCount": 1,
"aches": [{
"accountHolderTerminated": false,
"accountVerified": true,
"depositAmount1": null,
"depositAmount2": null,
"userCode": 0,
"accountingId": "les04",
"accountHolderEmailAddress": "[email protected]",
"accountHolderFirstName": "Sean",
"accountHolderMiddleName": "M.",
"accountHolderLastName": "Le",
"accountHolderName": "Sean Le",
"accountNumber": "9xxxxx54321",
"accountType": "Checking",
"paymentType": "Commissions",
"bankName": "",
"confirmAccountNumber": "",
"routingNumber": "123xxx6789",
"userId": "sle4",
"accountTypeIndicator": "C",
"dateAdded": "2018-04-16T09:44:44.627",
"dateAccountVerified": "2018-04-16T00:00:00",
"finalTerminationDate": null
}]
}
"decode" parses the aches array in the JSON object correctly.
But for some reason unknown to me it doesn't parse the value for totalRecordCount. The value comes out as 0.
This is how I did define the corresponding type for the JSON object in SAP:
TYPES: BEGIN OF agent,
accountholderterminated TYPE string,
accountverified TYPE string,
depositamount1 TYPE string,
depositamount2 TYPE string,
usercode TYPE string,
accountingid TYPE string,
accountholderemailaddress TYPE string,
accountholderfirstname TYPE string,
accountholdermiddlename TYPE string,
accountholderlastname TYPE string,
accountholdername TYPE string,
accountnumber TYPE string,
accounttype TYPE string,
paymenttype TYPE string,
bankname TYPE string,
confirmaccountnumber TYPE string,
routingnumber TYPE string,
userid TYPE string,
accounttypeindicator TYPE string,
dateadded TYPE string,
dateaccountverified TYPE string,
END OF agent.
TYPES: BEGIN OF web_service,
totalrecordcount TYPE i,
aches TYPE TABLE OF agent WITH DEFAULT KEY,
END OF web_service.
DATA: v_agent TYPE web_service.
Koemaeda, do you have any idea why? Again, the aches array does parse correctly; the only issues is with the totalRecordCound field.
Thank you very much for your time!
Best regards,
---Hugo
Hello @koemaeda, how are you?
I'm Brazilian and I want to contribute to the project. Do you accept?
Thanks for your project.
==================================================
Que legal cara, vi que você é brasileiro! Gostaria de contribuir com o projeto, posso?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.