i have need store key value pairs in string. cannot store them in other type because function passing these values takes param called additionaldata , of type string.
string data = "firstname: mike, lastname: jones, userid: 101"
i need able retrieve each value based on key.
i , string.join create array when retrieving prefer not because want use key value:
string data = string.format("{0}|{1}|{2} ", "mike", "jones", 101)
user user = new user { firstname = "mike", lastname = "jones", userid = 101 }; string userjson = jsonconvert.serializeobject(user);
you can create user object , parse json using https://www.nuget.org/packages/newtonsoft.json/
and later when want deserialize it, can use code below:
user user = jsonconvert.deserializeobject<user>(userjson);
hope helps.
Comments
Post a Comment