Nieuw lid |
|
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
The same text expressed as XML:
<menu id="file" value="File">
<popup>
<menuitem value="New" onclick="CreateNewDoc()" />
<menuitem value="Open" onclick="OpenDoc()" />
<menuitem value="Close" onclick="CloseDoc()" />
</popup>
</menu>
{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }} The same text expressed as XML: <menu id="file" value="File"> <popup> <menuitem value="New" onclick="CreateNewDoc()" /> <menuitem value="Open" onclick="OpenDoc()" /> <menuitem value="Close" onclick="CloseDoc()" /> </popup> </menu>
bron: http://www.json.org/example.html
Mijn vraag: heeft er iemand een vb waar een json array dynamisch wordt gevult?
Hier mijn poging die wel goed is, maar niet dynamisch:
var data = {
'action' : 'editPage',
'books': {
'book': [
{
"name": "boek1",
"id": "17"
},
{
"name": "boek2",
"id": "18"
}
]
}
}
var data = { 'action' : 'editPage', 'books': { 'book': [ { "name": "boek1", "id": "17" }, { "name": "boek2", "id": "18" } ] } }
|