Link to home
Start Free TrialLog in
Avatar of speedygonzalez
speedygonzalez

asked on

Create a JSON Clear Text String for a set of data.

Hello,

I need to create a JSON Clear Text String from a set of data I have.  I will then encrypt this string & pass it to a 3rd party in a URL.
Can I just create a string formatted to how JSON would be formatted, or do I need to create an actual JSON object  (Note I don;t need the string myself after it is created & encrypted & sent via the url.I Presume I can just construct a string without a need for an actual JSONObject)?

if Creating a string. Is the following a good example of how it should be created/formatted?

String jsonReturn='{email' + ':' + ' jim.secondname@test.com}';
jsonReturn = jsonReturn + '{user_type' + ':' + ' Sales Rep}';
jsonReturn = jsonReturn + '{first_name' + ':' + ' Jim}';
jsonReturn = jsonReturn + '{zip' + ':' + ' 12456}';
Therefore: email, user_type, first_name and zip are my four names and the values follow (e.g. jim.secondname@test.com is a value.

Does the above look like a correct JSON Clear Text String being created?

Thanks in advance.
Avatar of speedygonzalez
speedygonzalez

ASKER

Is the following then a correctly formatted JSON string

{email:jim.secondname@test.com}{user_type: Sales Rep}{first_name: Jim}{zip: 12456}

Thanks
or is the following correct

{emailjim.secondname@test.com,user_type:Sales Rep,first_name: Jim,zip:12456}

Avatar of Mick Barry
yes you can just build the string if thats your preference

> {emailjim.secondname@test.com,user_type:Sales Rep,first_name: Jim,zip:12456}

that last one is correct
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial