[serialization] or [spirit] JSON Archives

Hi, After experimenting with Spirit.Qi to make a JSON parser, I had the need for a serializer. First, I thought I could serialize my model of JSON (json:: value, json: object, etc.), but that was not compatible with boost::serialization. I am currently writing a ARCHIVE for Boost Serialization, but I'm finding some problems in order to implement JSON correctly. The question is, does anyone know about some files to Boost Serialization already finished? I've seen the Archive made by Esteve Fernandez, but do not serve my purpose, because I just need JSON. I would like to develop a JSON parser which in turn is a compatible Boost Serialization serializer . Any ideas? Thanks and regards, Fernando Pelliccioni.

On 14.6.2010 22:03, Fernando Pelliccioni wrote:
I would like to develop a JSON parser which in turn is a compatible Boost Serialization serializer . Any ideas?
Have you seen Boost Property Tree library? I have not tried it, but it does support JSON format to some extent. It might already have all you need. http://www.boost.org/doc/libs/1_43_0/doc/html/property_tree.html

On Tue, Jun 15, 2010 at 9:20 AM, Juraj Ivančić <juraj.ivancic@gmail.com> wrote:
I would like to develop a JSON parser which in turn is a compatible Boost Serialization serializer . Any ideas?
Have you seen Boost Property Tree library? I have not tried it, but it does support JSON format to some extent. It might already have all you need.
Indeed. A JSON parser in spirit has been done multiple times. The one in property tree is one example. It should also contain a serializer. TinyJSON is another. And yet, all of them are spirit classic. So at least, upon inventing this particular wheel the 3rd time it should be done in Qi. Cheers, Stephan

On Tue, Jun 15, 2010 at 4:41 AM, Stephan Menzel <stephan.menzel@gmail.com>wrote:
On Tue, Jun 15, 2010 at 9:20 AM, Juraj Ivančić <juraj.ivancic@gmail.com> wrote:
I would like to develop a JSON parser which in turn is a compatible Boost Serialization serializer . Any ideas?
Have you seen Boost Property Tree library? I have not tried it, but it does support JSON format to some extent. It might already have all you need.
Indeed. A JSON parser in spirit has been done multiple times. The one in property tree is one example. It should also contain a serializer. TinyJSON is another. And yet, all of them are spirit classic. So at least, upon inventing this particular wheel the 3rd time it should be done in Qi.
Cheers, Stephan
Hi, The parser should be written Qi, there is no other option for me. On the other hand, the objective is not only a parser but a Serializer, so I think you should follow the design of Boost.Serialization. I have not checked yet, but I think that Property Tree does not comply with these premises. Regards, Fernando Pelliccioni.

On Tue, 15 Jun 2010 11:12:58 -0300, Fernando Pelliccioni <fpelliccioni@gmail.com> wrote:
On Tue, Jun 15, 2010 at 4:41 AM, Stephan Menzel <stephan.menzel@gmail.com>wrote:
On Tue, Jun 15, 2010 at 9:20 AM, Juraj Ivančić <juraj.ivancic@gmail.com> wrote:
Have you seen Boost Property Tree library? I have not tried it, but
it
does support JSON format to some extent. It might already have all you need.
Indeed. A JSON parser in spirit has been done multiple times. The one in property tree is one example. It should also contain a serializer. TinyJSON is another. And yet, all of them are spirit classic. So at least, upon inventing this particular wheel the 3rd time it should be done in Qi.
Cheers, Stephan
Hi,
The parser should be written Qi, there is no other option for me. On the other hand, the objective is not only a parser but a Serializer, so I think you should follow the design of Boost.Serialization. I have not checked yet, but I think that Property Tree does not comply with these premises.
True. PTree's parser is written in Spirit.Classic (currently, though I eventually want to rewrite it), and is definitely not an Archive. PTree's JSON serializer does not use Spirit at all. Sebastian

On Tue, Jun 15, 2010 at 11:33 AM, Sebastian Redl < sebastian.redl@getdesigned.at> wrote:
On Tue, 15 Jun 2010 11:12:58 -0300, Fernando Pelliccioni <fpelliccioni@gmail.com> wrote:
On Tue, Jun 15, 2010 at 4:41 AM, Stephan Menzel <stephan.menzel@gmail.com>wrote:
On Tue, Jun 15, 2010 at 9:20 AM, Juraj Ivančić <juraj.ivancic@gmail.com> wrote:
Have you seen Boost Property Tree library? I have not tried it, but
it
does support JSON format to some extent. It might already have all you need.
Indeed. A JSON parser in spirit has been done multiple times. The one in property tree is one example. It should also contain a serializer. TinyJSON is another. And yet, all of them are spirit classic. So at least, upon inventing this particular wheel the 3rd time it should be done in Qi.
Cheers, Stephan
Hi,
The parser should be written Qi, there is no other option for me. On the other hand, the objective is not only a parser but a Serializer, so I think you should follow the design of Boost.Serialization. I have not checked yet, but I think that Property Tree does not comply with these premises.
True. PTree's parser is written in Spirit.Classic (currently, though I eventually want to rewrite it), and is definitely not an Archive. PTree's JSON serializer does not use Spirit at all.
Sebastian
The question is: Could I make a JSON serializer using the Archive model ?

Fernando Pelliccioni, I am having the exactly same requirement as you ask in this question. I have one serious limitation: I am new in C++, I came from Java and C#, and if I want to keep developing in C++, I need to be very fast in developing the requirements. Can you help me to serialize a json file? How do I do with the bellow example? Do you have some simple example? I can perform a parse each node by node on following example, but I am expecting some more productive way to do that. [{"DscTipoEstrutura":"Unidade de Neg\u00f3cio","FlgAtivo":true,"IdDominio":1,"IdTipoEstrutura":1,"NroOrdem":0},{"DscTipoEstrutura":"Regi\u00e3o","FlgAtivo":true,"IdDominio":1,"IdTipoEstrutura":2,"NroOrdem":1},{"DscTipoEstrutura":"Distrito","FlgAtivo":true,"IdDominio":1,"IdTipoEstrutura":3,"NroOrdem":2}] -- View this message in context: http://boost.2283326.n4.nabble.com/serialization-or-spirit-JSON-Archives-tp2... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (5)
-
demetrio
-
Fernando Pelliccioni
-
Juraj Ivančić
-
Sebastian Redl
-
Stephan Menzel