Jump to content

  • Log In with Google      Sign In   
  • Create Account


Alternative to JSON and XML?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
29 replies to this topic

#21 Shannon Barber   Moderators   -  Reputation: 1356

Like
2Likes
Like

Posted 18 December 2012 - 09:03 PM

Wanted to second/third YAML.
Otherwise you're back to .ini files or roll-your-own.

PS LiquidXML is an awesome tool for XML schema creation. I used it through beta to release.
LiquidXML would be most useful with C# or maybe Java; don't think it'd help much with C code.

Edited by Shannon Barber, 18 December 2012 - 09:03 PM.

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Sponsor:

#22 shadowomf   Members   -  Reputation: 315

Like
1Likes
Like

Posted 27 December 2012 - 04:34 PM

Another one, a more human friendly version of JSON perhaps:

http://bitsquid.blogspot.de/2009/10/simplified-json-notation.html

 

Just as with any customized format you would have to convert it if you need to use it inside another application.



#23 tufflax   Members   -  Reputation: 478

Like
0Likes
Like

Posted 27 December 2012 - 05:36 PM

https://github.com/edn-format/edn is a nicer and richer format than JSON and XML. If there is some kind of library that deals with it in C++ or whatever, you should try it.



#24 swiftcoder   Senior Moderators   -  Reputation: 9672

Like
0Likes
Like

Posted 27 December 2012 - 06:20 PM

https://github.com/edn-format/edn is a nicer and richer format than JSON and XML. If there is some kind of library that deals with it in C++ or whatever, you should try it.
It's richer than JSON, at any rate. Doesn't look nearly as rich as XML...

But is richness a good thing in most use-cases? The main reason I advocate YAML over XML is it's simplicity - if you don't need schema validation, XPath, XSLT, or any of the other fancy addons to XML, it's just so much added cruft.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#25 Nairou   Members   -  Reputation: 418

Like
0Likes
Like

Posted 28 December 2012 - 07:22 AM

I've never liked XML, and I have many of the same objections to JSON that you do. I'm not aware of any library that does exactly as you are asking for, though. Personally, I like to use Lua for my game files and data. It's quite handy for data description, even if I don't use it as an embedded script but just to load and move data.

Interesting. I've heard of Lua being used for data storage, and it certainly has a decent syntax for it. But how complex is it to read and write values? I always assumed you had to load up the file into a Lua VM, then perform stack calls into the VM to access your data. Which sounds overly complex when compared to other JSON/XML library APIs.



#26 Nairou   Members   -  Reputation: 418

Like
0Likes
Like

Posted 28 December 2012 - 07:24 AM

But is richness a good thing in most use-cases? The main reason I advocate YAML over XML is it's simplicity - if you don't need schema validation, XPath, XSLT, or any of the other fancy addons to XML, it's just so much added cruft.

Exactly. Simplicity is key here. I'd use INI files if I didn't need to store other types of data than just simple values.



#27 JTippetts   Moderators   -  Reputation: 8161

Like
2Likes
Like

Posted 28 December 2012 - 08:28 AM

I've never liked XML, and I have many of the same objections to JSON that you do. I'm not aware of any library that does exactly as you are asking for, though. Personally, I like to use Lua for my game files and data. It's quite handy for data description, even if I don't use it as an embedded script but just to load and move data.

Interesting. I've heard of Lua being used for data storage, and it certainly has a decent syntax for it. But how complex is it to read and write values? I always assumed you had to load up the file into a Lua VM, then perform stack calls into the VM to access your data. Which sounds overly complex when compared to other JSON/XML library APIs.

 

Pretty much this. Until recently I used Lua for this kind of thing extensively, but unless you like writing lots of tedious stack calling to get your data, you have to code an extra interface layer to allow Lua to build and populate your objects directly. Thanks to swiftcoder in this thread, I started using yaml-cpp and I have to say I'm a fan. Building a YAML node manually or reading data from a node are dead simple using the "new" interface, and structurally my data is very similar to a Lua table, as long as I only need data and not Lua functions-as-data.

 

Note that the yaml-cpp stable build is for the "old" interface which is apparently much clunkier; grab the latest build from the repository which supports syntax such as

node["x_resolution"]=1280
and
bool fullscreen=node["fullscreen"].as<bool>();
so streaming data in an out is a breeze.



#28 Nairou   Members   -  Reputation: 418

Like
0Likes
Like

Posted 28 December 2012 - 08:34 AM

Pretty much this. Until recently I used Lua for this kind of thing extensively, but unless you like writing lots of tedious stack calling to get your data, you have to code an extra interface layer to allow Lua to build and populate your objects directly. Thanks to swiftcoder in this thread, I started using yaml-cpp and I have to say I'm a fan. Building a YAML node manually or reading data from a node are dead simple using the "new" interface, and structurally my data is very similar to a Lua table, as long as I only need data and not Lua functions-as-data.

 

Note that the yaml-cpp stable build is for the "old" interface which is apparently much clunkier; grab the latest build from the repository which supports syntax such as

node["x_resolution"]=1280
and
bool fullscreen=node["fullscreen"].as<bool>();
so streaming data in an out is a breeze.

Oh nice!! The old interface is what I tried last, and it certainly wasn't very friendly (and liked to spit out lots of compiler warnings). I'll have to give the new one a try, that interface looks great.

 

I'm always wary of downloading work-in-progress snapshots of code from a repository. Any issues that you've seen so far?



#29 tufflax   Members   -  Reputation: 478

Like
0Likes
Like

Posted 28 December 2012 - 06:18 PM

But is richness a good thing in most use-cases? The main reason I advocate YAML over XML is it's simplicity - if you don't need schema validation, XPath, XSLT, or any of the other fancy addons to XML, it's just so much added cruft.

Exactly. Simplicity is key here. I'd use INI files if I didn't need to store other types of data than just simple values.

https://github.com/edn-format/edn is simple because it allows several data structures (lists, maps, sets), so no overloading or other wierdness is going on.



#30 JTippetts   Moderators   -  Reputation: 8161

Like
0Likes
Like

Posted 28 December 2012 - 07:02 PM

Oh nice!! The old interface is what I tried last, and it certainly wasn't very friendly (and liked to spit out lots of compiler warnings). I'll have to give the new one a try, that interface looks great.
 
I'm always wary of downloading work-in-progress snapshots of code from a repository. Any issues that you've seen so far?

 

So far, I haven't run into any troubles. It seems pretty stable.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS