Disclaimer: I am totally new to protobuf, engaged in an exploratory POC.  
Please forgive dumb questions :-)

We are looking at migrating an existing, JSON-based protocol in which 
hand-coded C++ is written to perform serdes between objects and JSON. We 
want to replace the hand-coding with an automated approach that can be 
shared between C++ and Java.  However, a stumbling block I see is that some 
messages have an arbitrary field full of JSON like:

{
   "name":"john", 
   "address":"123 main st",
   "attributes":{ any JSON can go here }
}

While I realize that we could stringify the JSON, this breaks our published 
API.  Is there any way I can use protobuf to perform serdes between message 
like this and some struct like:

{
   string name;
   string address;
   json attributes;
}

I'm even OK if the internal data is stringified JSON:

{
   string name;
   string address;
   string attributes;
}

So long as the exchanged JSON isn't stringified.  In other words, this is 
bad:
{
   "name":"john", 
   "address":"123 main st",
   "attributes":"{ \"attr1\":\"value1\", \"attr2\":[\"elem1\", \"elem2\"] }"
}

It needs to be exchanged like
{
   "name":"john", 
   "address":"123 main st",
   "attributes":{ "attr1":"value1", "attr2":["elem1", "elem2"] }"
}

Is this possible?

Thanks
john

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to