Questions tagged [json-serialization]
302 questions
0
votes
2 answers
PUT request in iOS (Swift) with JSONSerialization
I'm trying to update an attribute via PUT request using JSONSerialization.
Here is my function :
func updateRGPDStatus(user:UserModel){
let parameters = ["firstname": user.firsname as Any,
"lastname":…

Hajar ELKOUMIKHI
- 94
- 3
- 11
0
votes
1 answer
How to exclude fields in a DART Model using another class and JsonKey?
I have a model as shown below.
@JsonSerializable()
class Vehicle{
final String name;
final String make;
final String model;
final int year;
final int tires;
final int seats;
Vehicle({
this.name,
this.make,
this.model,
this.year,
…

SUPARNA SOMAN
- 2,311
- 3
- 19
- 35
0
votes
1 answer
Using a static method instead of a factory using json_serializable
Is there a reason why using json_serializable I should use a factory constructor instead of a static method?
I would need to use a static method, but I'm wondering about the downsides

imtoori
- 570
- 6
- 13
0
votes
1 answer
How to Return a List<> as Json in Web api c#
I try some way to return JSON but i am not able to do perfectly.
Here is my Code
Public string GetData(){
List result = new List();
// Fill data from Database
string isonData = JsonConvert.SerializeObject(result);
return…

Dhruv Savaj
- 1
- 5
0
votes
2 answers
How to return empty json array in asp.net core
In ASP.NET Core 2.0 Web API, when an object is empty, it will return a JSON array with null values like this:
{
"code": "1",
"message": null,
"data": {
"formSettings": [
null,
null
]
}
}
How…

Abdumalik Nabiev
- 311
- 1
- 3
- 14
0
votes
1 answer
Apex extracting fields from a trigger to create a custom JSON
I have created a trigger for Order Object and only want specific fields to be pulled from that object to create a custom JSON data structure. I have tried saving the fields that I need from the object into local variables, placing them into a list…

Richard
- 19
- 1
- 5
0
votes
2 answers
How to write integration tests involving DateTime Json serialization in ASP.NET Core 3.0?
I am writing an integration test for an Api Controller in ASP.NET Core 3.0. The test is for a route that responds with a list of entities. When I try to make the assertions on the response content, there is a divergence in the way the DateTime…

Kuteken
- 3
- 1
- 1
0
votes
0 answers
Language neutral and small in size serialization for java objects
I want to migrate an application which currently uses java serialization to a one which is language neutral like JSON with polymorphic serialization/deserialization the problem is my objects are very large and that is causing to generate large JSON…

Suvrat
- 13
- 6
0
votes
0 answers
Symfony : How to deserialize a JSON file that contains a set of objects that have properties made of an array of objects?
In Symfony, I try to deserialize a set of objects of type "Activity" from a JSON file. Every object activity contains three properties:
Intger Id.
Property of Class type "Person" called "host".
Array of Objects of class type "Person" called…

TheMrGoycochea
- 1
- 1
0
votes
1 answer
Spring Json-Serialization with @JsonView return empty objects for associations
I have a Spring-Boot-Project with JPA and JSON-Serialization. I try to use @JsonView to serialize only specified Properties. It works ok, but for my associations in Order (e.g. order.user) it serialized empty Json-Object.
I use following…

Antje
- 41
- 8
0
votes
1 answer
JSON serialization of different attributes of a single entity for different requests using Jackson
There are several REST calls that require the same JSON entity with a different set of attributes. Example of the entity:
public class JsonEntity
{
public String id;
public String name;
public String type;
public String…

Ihor Patsian
- 1,288
- 2
- 15
- 25
0
votes
1 answer
How to serialize an C# object to specific JSON
I wanted to serialize C# object to JSON using Newtonsoft. I am able to serialize object with properties but didn't get expected JSON. I tried with layout property but didn't worked for me.
Expected…

Ronak
- 127
- 3
- 15
0
votes
2 answers
Serializing a pojo as a nested JSON dictionary
Given the simple POJO:
public class SimplePojo {
private String key ;
private String value ;
private int thing1 ;
private boolean thing2;
public String getKey() {
return key;
}
...
}
I have no issue in…

Eric
- 154
- 6
0
votes
0 answers
Post request to asp.net core web API and issue with Serializer Settings
I want to send a post request (using postman) to Asp.net core web API and my API is like this:
[HttpPost]
public IActionResult Create(CreateTransferItemCommand command)
{
try
{
_transferCommandFacade.CreateTransferItem(command);
…

Armin Kianian
- 143
- 2
- 10
0
votes
1 answer
Newtonsoft JSON/JSON.NET custom serialization - System.Object members not correctly deserialized even when setting TypeNameHandling
I'm trying to implement custom serialization using Newtonsoft.Json where I want all fields serialized, and then deserialized to their proper types. The class contains a field of type "object", implements ISerializable, has a [Serializable] attribute…

Hallgeir
- 1,213
- 1
- 14
- 29