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
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
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)
Guid Should be passed with quotes
"Id" : "9903ED01-A73C-4874-8ABF-D2678E3AE23D"
Simple {"a241306c-235d-4cab-a728-a18236844776"}
worked for me.
I was trying to deserialize JSON into a class
public class EraseData
{
public int Size { get; set; }
public IEnumerable<Guid> EnterpriseIds { get; set; }
}
and this was valid JSON syntax.
{
"Size": 10,
"EnterpriseIds": [
"a241306c-235d-4cab-a728-a18236844776",
"977fbb1d-5d3f-47a5-a33d-0762ef5d9ac7"
]
}
Guid is treated as a string so you should go with "9903ED01-A73C-4874-8ABF-D2678E3AE23D"
© 2022 - 2024 — McMap. All rights reserved.