4 ms·
------- Quoting the parent: This turns into this beautiful JSON: [ "users": [ { "id": "abc", "phoneNos": [ { "type": "home", "value": "1
by spin 13y ago
------- Quoting the parent:
This turns into this beautiful JSON:
[
"users": [
{
"id": "abc",
"phoneNos": [
{ "type": "home", "value": "123456789" },
{ "type": "work", "value": "321654987" }
]
}
]
]
------ ... endquote.
That's a strange, contrived example. In Javascript, I would write it like this:
user = {id: "abc", homePhone: "123456789", workPhone: "321654987"};
(And the next time that object goes across the network, my libraries will be nice enough to put the quotes around the keys for me.)
- deno 13y agoThat’s not at all strange – the type is variable and can be specified by user. Not to mention you can have more than one home or work number. You sure can serialize your data to your keys, but then that would be rather strange. Anyway just imagine there’s an extra field, problem solved: <phoneNo type="home" priority="1">…</phoneNo>