Questions tagged [json-serialization]
302 questions
0
votes
0 answers
i'm getting local datetime from database using json
I'm getting data from database in json format. local datetime is problem…
0
votes
1 answer
Custom formatting for just a portion of data during JSON serialization
I have a Python object tree I want to serialize. Its structure is something like this:
{
"regular_object": {
...
},
"regular_field": ...
"special_object": {
"f1": "v1",
"f2": v2,
...
"fn":…

Semisonic
- 1,152
- 8
- 21
0
votes
1 answer
Serializing C# model with a custom list to JSON
I have a model with a list that I need to serialize to JSON in order to send a request to a web service.
The problem is that in my model I have a list that need to be serialized in a specific format.
My class looks like the…

ConsS
- 25
- 8
0
votes
1 answer
How do I fix 'type '() => T' is not a subtype of type 'T' in type cast'
am manually setting up a model class with json (de)serialization. By now I have implemented some testcases. In particular one where I check if toJson -> fromJson is the identity for my model type called Session.
Here is the relevant part of my model…

fxvdh
- 147
- 9
0
votes
5 answers
How to persist an object-model to JSON and serialize a dictionary as its array of values?
public class Portfolio
{
public string Name {get; set;}
public Dictionary Positions {get; set;}
}
public class Position
{
public string Ticker {get; set;}
public decimal Size {get;…

BaltoStar
- 8,165
- 17
- 59
- 91
0
votes
0 answers
String is not parsing in JSONSerializer
i have a json string like
{"id":0,"version":0,"subject":"[2sravya] data","description":"[10nd data] description [AWS Account:12234]","createdDate":null,"visibleToCustomer":false,"externalEMailId":null}
After it is converted to JSONObject using…

sravya varma
- 11
- 2
0
votes
1 answer
JSONSerialize and Post JSON to server in Swift
I am trying to post some data to a server using Swift:
To create the JSON I do the following.
let json: [String: Any] = ["jwt": jwt as Any, "comment": newmessage as Any,"isuser": true,"ismax": false]
This seems to work as the debugger shows 4…

user1904273
- 4,562
- 11
- 45
- 96
0
votes
4 answers
Newtonsoft Json Serialize/Deserialize nested property
I have the following class structure
public class MainClass
{
public string MyStringValue {get;set;}
public SecondClass MyClassValue {get;set;}
}
public class SecondClass
{
public string Value {get;set;}
}
I set the following…

Pinzi
- 293
- 6
- 18
0
votes
1 answer
JSON Parsing Swift using JSONPlaceholder
I'm playing with Swift and JSONPlaceholder. I want to retrieve all the data contained in: https://jsonplaceholder.typicode.com/photos
I created a function that is acceding to the url, downloading the JSON but then I don't know how can I obtain the…

Pietro Messineo
- 777
- 8
- 28
0
votes
2 answers
HTTP Post Request API - Parsing JSON wrapped in Single Quotes
My API accept only Single Quote wrapped JSON. Like:
'{"api_key":"key_api1234","api_secret":"asdfg","uniqueid":"LDM23564GQQP","password":"test1","pin":"94729"}'
I could find a definitive answer neither here nor on the internet.
I Tried many syntax…

Inaldor
- 23
- 1
- 4
0
votes
3 answers
Spring Boot + Jackson: Serialize an object in different ways depending on the called REST API
I am developing a Spring Boot web application that exposes REST APIs and I have trouble with JSON Serialization.
Let's say I have two classes A and B, that are in a one-to-many bidirectional relationship.
This means that I have something like…

Andrea Rossi
- 981
- 1
- 10
- 23
0
votes
1 answer
Azure Function v2 queue trigger only takes in Json messages
I have an azure function project with a queue trigger; the project is an azure function v2.
When I add messages to the queue that are not of type JSON, I get an exception inside the JsonSerialization.cs at the line JObject parsed =…

A.J Alhorr
- 527
- 7
- 27
0
votes
1 answer
Is there a way to conditionally serialize C# list objects based on a property?
I have an MVC Model that generates JSON files, based off of user inputs, that are used as part of an automated workflow. The issue that I am having is figuring out how to change the order in which a list of objects are serialized based off of a…

C Murphy
- 47
- 1
- 13
0
votes
1 answer
Serialize for JavaScript apex
I need to serialize some simple object from .NET to JavaScript...
But I've some problem with apex...
C# example
var obj = new { id = 0, label = @"some ""important"" text" };
string json1 = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
string…

giacomo
- 51
- 1
- 10
0
votes
0 answers
@XmlElement doesn't always work when producing both JSON and XML using Jersey
I am serializing a POJO into either JSON and XML depending on the Accept header.
@Path("/json/metallica")
public class JSONService{
@POST
@Path("/post")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public…

Rem
- 46
- 6