We use OpenRasta routes to communicate between our UI and MT code. We use 
Protobuf to communicate our request and respond to and fro. 

The UI is sending me a serialized json that I then deserialize into an 
object without an issue

The json looks like this:

"lang":{"en-US":{"name":"AS Test Assembly Activity","description":"Activity 
to test assembly activities"}}

and the jsonSerializer correctly puts it into the property which has a 
dataType of Dictionary<string,class> (class being a serialized class with 
fields of name and description)


Now my problem is I am trying to pack the data from this dictionary<> back 
into a proto so that the output will be the same as the above json.

This is what the output currently is:

"lang":{"key":"en-US","lang":[{"name":"AS Test Assembly 
Activity","description":"Activity to test assembly activities"}]}


Notice the field names of the proto are there ('key' and 'lang')

How should my proto messages look in order to get the desired output?

Here are my proto messages now:

message CustomActivityConfiguration {
optional LanguageCulture lang = 1;
}

message LanguageCulture {
required string name = 1;
repeated CustomActivityLanguage lang_data = 2;
}

message CustomActivityLanguage {
optional string name = 1;
optional string description = 2;
}


Here is how I am trying to pack the proto

var customActivityLanguage = new CustomActivityLanguage.Builder()
{
    Name="AName",
    Description="ADescription"
}

var languageCulture = new LanguageCulture.Builder()
{
    LangData = langData.Build(),
    Name = "en-US"
}

CustomActivityConfiguration.Lang.Add(languageCulture.Build());
   
This is what the output currently is:

"lang":{"key":"en-US","lang":[{"name":"AS Test Assembly 
Activity","description":"Activity to test assembly activities"}]}


This is what I am trying to get too:

"lang":{"en-US":{"name":"AS Test Assembly Activity","description":"Activity 
to test assembly activities"}}


Any help would be appreciated. I am running out of idea's.

This is C# using OpenRasta rest routes that implement proto..any other type 
of information needed let me know.

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to