I have a json string:
var jsonstr = "{ 'property1: 'myvalue','property2':2 }";
JObject json2 = JObject.Parse(jsonstr);
and want to write to firestore but the values are empty arrays instead of the values.
var task = collection.Document("test2").SetAsync(json2);
NewtonSoft JSON : https://www.newtonsoft.com/json
You're going to want to Serialize your object.
var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
var text = JsonConvert.SerializeObject(configuration, settings);
The json is missing a closing ' character on property1. Technically, you should be using double quotes instead of single on JSON.
var jsonstr = "{ 'property1': 'myvalue','property2':2 }";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With