You are not logged in.
Pages: 1
I'm new using this framework, how to decode array of multiple json? I've tried using such code:
JSONDecode(jsonText,['x','w','d'],hasil,true);
But I only get the last object value
Example JSON is
[{
"x" : 2546,
"w" : "kibik",
"d" : "<b>kubik<\/b>"
}, {
"x" : 14564,
"w" : "kubik<sup>1<\/sup>",
"d" : "data two"
}, {
"x" : 100,
"w" : "kubik<sup>2<\/sup>",
"d" : "string three"
}
]
Offline
I think I must read this first..
Amazing framework anyway..
Offline
Our JSONDecode() functions do process the content in-place, and expect one object at a time.
It does not have any "DOM-like" trees, as other parsers do. But it is the reason why it is so fast, by the way.
For you request, to decode such JSON object arrays, you can use a TObjectList, providing the class instance to JSONToObject() function - it will read all objects using published properties of the supplied class.
No need to populate an intermediate DOM.
Offline
Thank you ab..
I'll try using TObjectList, I always follow this fw development and always amaze with it
Super fast, not depend on DB unit or another new features in D2007.. XE, XE2... (so I can work using my old Delphi 7), unicode support, plus the documentation is 'wow'.. And another what I wonder is that almost all of this framework was develop by single person..
Even sometimes I can't figure yet or find the way to solve my problem using mORMot
(Usually I just coding using procedural type)
Last edited by ebz (2013-02-17 15:46:04)
Offline
Yes, this is a major mind break to switch from a procedural type to OOP and interfaces.
But not difficult.
I suspect most of your procedural code is some kind of "object oriented": that is, you apply a function over a reference to some data - which is just some kind of "flattened OOP", like SQLite3, Windows or Linux API.
But I'm not alone on mORMot any more: even if I'm the main developer, I've already received amazing contributions.
So stay tuned, a lot of amazing stuff is coming!
Offline
Pages: 1