Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I represent a GUID in a json object?

Tags:

json

guid

For GUID type in JSON, do we need double quote like

"Id": "9903ED01-A73C-4874-8ABF-D2678E3AE23D" 

or just like

"Id" : 9903ED01-A73C-4874-8ABF-D2678E3AE23D
like image 827
user496949 Avatar asked Nov 19 '10 23:11

user496949


People also ask

How do you write a key-value pair in JSON?

Each key-value pair is separated by a comma, so the middle of a JSON lists as follows: "key" : "value", "key" : "value", "key": "value" . In the previous example, the first key-value pair is "first_name" : "Sammy" . JSON keys are on the left side of the colon.

How do you describe a structure in JSON?

A JSON object contains zero, one, or more key-value pairs, also called properties. The object is surrounded by curly braces {} . Every key-value pair is separated by a comma.

Can JSON have value without key?

Keys must be strings, and values must be a valid JSON data type: string.

Can JSON contain array?

Arrays in JSON are almost the same as arrays in JavaScript. In JSON, array values must be of type string, number, object, array, boolean or null. In JavaScript, array values can be all of the above, plus any other valid JavaScript expression, including functions, dates, and undefined.


2 Answers

There is no such thing as a 'GUID Type.'

You need to put it in quotes. A GUID is just a string, and string need quotes.

All of the types are listed here on the JSON website. (Look on the right side)

like image 187
jjnguy Avatar answered Sep 28 '22 04:09

jjnguy


Guid Should be passed with quotes

"Id" : "9903ED01-A73C-4874-8ABF-D2678E3AE23D"

like image 32
Ravi Avatar answered Sep 28 '22 04:09

Ravi