Forum General

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to convert two SerializeObject into one SerializeObject.

kefkef Member ✭✭✭
edited June 2020 in General

dict1={"type":"check"}
dict2={"mac":"00:00:00:00:00:00"}

var json = JsonConvert.SerializeObject(dict1);
var jsonStr = JsonConvert.SerializeObject(dict2);

var arrayOfObjects = JsonConvert.SerializeObject(
new [] { JsonConvert.DeserializeObject(json ), JsonConvert.DeserializeObject(jsonStr) });

It convert

[
{
"type": "CHECK_CONNECTION"
},
{
"mac_address": "00:00:00:00:00"
}
]

I want :smile:

final output={
"type":"check",
"mac_address":"00:00:00:00:00:00"
}

Best Answer

Answers

Sign In or Register to comment.