Deserialize response from firebase
Tag : chash , By : Bimal Poudel
Date : March 29 2020, 07:55 AM
wish helps you I am using c# interacting with Firebase via the provided REST api. , Here you go (a bit ugly): public class Item
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Value { get; set; }
}
dynamic data = JsonConvert.DeserializeObject<dynamic>(jsonString);
var list = new List<Item>();
foreach (var itemDynamic in data)
{
list.Add(JsonConvert.DeserializeObject<Item>(((JProperty)itemDynamic).Value.ToString()));
}
dynamic data = JsonConvert.DeserializeObject<dynamic>(jsonString);
var shorter = ((IDictionary<string, JToken>)data).Select(k =>
JsonConvert.DeserializeObject<Item>(k.Value.ToString())).ToList();
|
Deserialize response in object C#
Tag : chash , By : Steve Jones
Date : March 29 2020, 07:55 AM
like below fixes the issue You are not telling the serialiser what the default namespace is. Try this: var stream = new StringReader(dd);
XmlSerializer s = new XmlSerializer(typeof(RunQueryReply), "http://www.ibm.com/xmlns/db2/cm/beans/1.0/schema");
var a = (RunQueryReply) s.Deserialize(stream);
|
Deserialize elasticsearch response in object
Tag : chash , By : gorbiz
Date : March 29 2020, 07:55 AM
Does that help I am getting below response from ElasticSearch REST API. , Try this class Document
{
public Hits hits { set; get; }
}
class Hits
{
public IEnumerable<Hit> hits { set; get; }
}
class Hit
{
public Source _source { set; get; }
}
class Source
{
public string type { set; get; }
}
|
Deserialize Json Response to Object
Tag : chash , By : marocchino
Date : March 29 2020, 07:55 AM
I wish this helpful for you The response that's being returned from the server here is the JSON representation of a string, which is itself the JSON representation of the object you're expecting. The server is first encoding the object as JSON and then encoding that serialised JSON string as JSON once again. You've already confirmed in the comments that the solution to this is to fix the server to encode the data only once, so I've written this answer out here for completeness.
|
Is it possible to serialize and deserialize an object that contain an object as a variable in Firebase?
Date : March 29 2020, 07:55 AM
I wish this help you The Firebase database serializes/deserializes any public fields, and public properties that follow JavaBean naming conventions for getters and setters. Since the classes you show contain neither of those, they will not read or write any data. If you mark the fields as public or add public getters/setters, then writing an instance of the Profile class will generate this JSON: "userID": {
"tenant": {
"name": "the name",
"room": {
"town": "the town",
"size": 42
}
}
}
|