Questions tagged [json-serialization]
302 questions
1
vote
2 answers
What is meant by Flattening and Unflattening of Json? Also can we use ObjectMapper class to deserialize a flattened json attribute?
I am trying to understand what exactly is it to flatten a Json and Unflatten a Json. Any links or blogs would be helpful.
Also w.r.t the additional question, I am trying to deserialize a flattened json attribute into objectmapper object. The Json I…

Tushar Jadhav
- 15
- 1
- 5
1
vote
1 answer
JSON in C#: How do I get all objects in a json string below a certain class?
I am trying to get everything below apps and put the values inside a Dictionary
I am using the below code.
Class:
public class Games
{
public int AppId { get; set; }
public string Name { get; set; }
}
Code:
public…

Brian
- 1,951
- 16
- 56
- 101
1
vote
0 answers
Overriding @JsonProperty in a subclass with @JsonIgnore
I have a parent class
public class Parent {
@JsonProperty("ID")
private int id;
// getter and setter
}
and a corresponding subclass
public class Child extends Parent {
@Override
@JsonIgnore
public int getId() {
…

stan
- 95
- 2
- 8
1
vote
1 answer
JsonMappingException: Direct self-reference leading to cycle (through reference chain: MyClass["underlyingValue"])
I have a POJO class extending net.sf.gilead.pojo.gwt.LightEntity. I am not able to serialize the POJO object to JSON string using com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(obj). I am getting this…

Jayram Kumar
- 682
- 2
- 16
- 28
1
vote
1 answer
JsonConvert SerializeObject not correctly serializing String Array
I'm posting some JSON to a REST server using the following RestConnector:
using Newtonsoft.Json;
public static T httpPost(String myURL, Dictionary data) {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myURL);
…

Fueled By Coffee
- 2,467
- 7
- 29
- 43
1
vote
1 answer
JSON Serialization of Subclass to Superclass
I have two classes:
Superclass:
public class A
{
public int a;
public A(int a)
{
this.a = a;
}
}
Subclass:
public class B extends A
{
public B(int a)
{
super(a);
}
}
I use Jackson to…

Vitali Melamud
- 1,267
- 17
- 40
1
vote
1 answer
Swift 4 Ambiguous reference to member 'jsonObject(with:options:)'
Trying to setup a unit test which performs a network request and attempts to serialize the response. I'm currently getting the error: Ambiguous reference to member 'jsonObject(with:options:)'. Confused as to why this is happening as the unit test…

user7684436
- 697
- 14
- 39
1
vote
1 answer
aspnet core json ignore duplicate fields
How do I ignore duplicate fields?
For example I have this raw json { "Value": 3, "Name": "Test", "value": "irrelevant" }
I would like to ignore value because my target type has public int Value { get; set; }
We have this kind of issue on most of the…

herme 0
- 912
- 1
- 9
- 23
1
vote
0 answers
Replace escape character \ from generated JSON string Xamarin.Android
In my Xamarin.Android project, I'm using NewtonSoft Serialization to serialize my Object into JSON string. But when I do this my string has escape characters like this:
{\"id\":\"45912345\",\"number\":\"c6474a2345\"}
But I want like…

pratiti-systematix
- 792
- 11
- 28
1
vote
0 answers
Unity Json.Net: Error setting value
I'm trying to create a convenient serialized reference to asset objects. It serialized correctly, but deserialization fails with exception
"Error setting value to 'textAssetRef' on 'TestData'."
I've prepared a small test component for Unity to…

v3nz
- 33
- 4
1
vote
2 answers
Parsing response form AWSTask, returned from lambda in iOS swift 3
Any suggestions in how to parse AWSTask.result into JSON object? I am invoking AWS Lambda function, which returns a JSON string
code below
let task = lambdaInvoker.invokeFunction("LambdaFunction", jsonObject: ["processName":processName])
…

Vasu Seshadri
- 31
- 1
- 2
1
vote
2 answers
How to correctly parse a nested json string to a proper json?
"{\"event\":\"posted\",\"data\":{\"channel_display_name\":\"\",\"channel_name\":\"e6webbgbt7gp8ryb4yyheiyrcw__jbk5semtk3dhjqzcoscu7g4yhe\",\"channel_type\":\"D\",\"mentions\":\"[\\\"jbk5semtk3dhjqzcoscu7g4yhe\\\"]\",\"post\":\"{\\\"id\\\":\\\"4fu4ey9…

Bibek
- 3,689
- 3
- 19
- 28
1
vote
1 answer
How can I get the JSON response in dictionary format in swift3?
I'm working on JSON serialization like below code:
let jsonData: Data? = try? JSONSerialization.data(withJSONObject: abc, options: .prettyPrinted)
let parsedDict = String(data: jsonData!, encoding: String.Encoding.utf8)
print(" parse Dict…

Nandu Psycho
- 21
- 7
1
vote
1 answer
What to cast JSON response as in JsonSerialization for specific Json Response
JSON response:
{
"matches": [
{
"platformId": "EUW1",
"gameId": 3427082245,
"champion": 21,
"queue": 450,
"season": 9,
"timestamp": 1511224973899,
"role": "NONE",
"lane":…
user6911980
1
vote
0 answers
Max Length of JSON Serialization
In ASP.NET MVC, Can I go beyond the max length of JSON?
var jsonResult = Json(data, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
My data here is greater than max value. If no, how can I send the data…

Alexander Paes
- 101
- 4
- 13