This tag can be used when you want to convert any text, objects or other formats into a JSON object,or if you want to transform a JSON object into something else.
Questions tagged [jsonconvert]
207 questions
0
votes
1 answer
Deserializing JSON to C# Class
I'm calling an API that returns JSON data as follows (the array has around 500 items):
[
[
1571702400000,
"8197.28000000",
"8297.99000000",
"8000.00000000",
"8020.00000000",
"34651.82866300",
…

Ross Kelly
- 477
- 1
- 6
- 23
0
votes
0 answers
Newtonsoft JSON serialization - how to flatten a reference type field
I have a class (MyClass), in which there is a reference type field (let's call MyNestedClass).
I'm using Newtonsoft, and I would like to serialize this class, including this field. But instead of "opening a new block" in the Json (a Json object), I…

user2369698
- 1
- 2
0
votes
1 answer
Using JsonConvert.DeserializeObject, how to warn about missing members, but continue deserializing?
I am using JsonConvert.DeserializeObject to deserialize some objects. There is a possibility that the properties in the json file may not be present in the corresponding definition. When this happens, I want to essentially ignore the field and…

N-C
- 155
- 1
- 9
0
votes
2 answers
Json to other Java object convertion
as in the title, I need to convert the JSON file to a java object. I'm looking for a Spring or Java solution for this problem.
Here is my controller class (it will be refactored later)
package pl.githubdetails.GithubDetails.presentation;
import…

Oskar
- 379
- 4
- 21
0
votes
1 answer
Is there a good way to create general property name can support multi properties?
I need to create a data class which used for JsonConvert. Most of the resource string which used to be converted are same except the following properties:
public class DataType
{
public DateTimeOffset CreateDate { get; set; }
public…

Deritha
- 67
- 2
- 9
0
votes
1 answer
How to implement class which can be used to de-serialize multiple level json?
I have a json string like:
{
"sn_request": {
"sn_body": {
"getExtensionlink": {
"pid": null,
"productUrl": "https://xx",
"promotionId": null,
"quanUrl": null,
…

Edward
- 28,296
- 11
- 76
- 121
0
votes
3 answers
How to know json structure of a big java object?
I hava a pojo with lots of classes attached to it. Wanted to know the JSON structure to be passed to the API.
Is there any way to create the json structure (with some fake data)?
Example:
public class Staff {
private String personName;
…

smilyface
- 5,021
- 8
- 41
- 57
0
votes
1 answer
deserialize a object to return empty string for object type nullable datetime
I am trying to deserialize a object. It returns null for a object of nullable datetime (Collected)
public async var GetOrders()
{
var orders = await db
.GetDataTableAsync($"query")
.GetRows()
.Select(r =>…

Really me
- 1
- 2
0
votes
0 answers
How to use the NewtonSoft JsonConverterAttribute and JToken.FromObject() without calling the JsonConverter recursively
I have taken the code from this example and changed a few things:
remove the custom constructor and hardcode the CanConvert type.
removed the converter from the calls JsonConvert.SerializeObject() and JsonConvert.DeserializeObject()
added a…

Louis Somers
- 2,560
- 3
- 27
- 57
0
votes
2 answers
How to dynamically change JSON records?
I have a JSON string in the following structure:
"{'Country':'USA','City':'New York','Population':'8554554','Area':'545887','jsonArgs':'{\"BuildingsTypes\":\"Offices\"}','keywords':['keyword1','keyword2']}"
What I need to do is to update Area and…

markus
- 81
- 7
0
votes
1 answer
Iterate JObject without foreach
This piece of code is working fine i'm iterating JObject using foreach loop
HttpResponseMessage response = await clientHelper.PostAsJsonRequest("home/LoadPatientDetailData/2232565", new { });
if (response.IsSuccessStatusCode)
{
…

Zubair Khakwani
- 328
- 5
- 18
0
votes
0 answers
Skip Nullable int while parsing Json Response to C# object
i'm parsing a json response to c# object
My Model
public class OutstandingPrompts
{
public int? PatientID { get; set; }
public int? AlertTypeID { get; set; }
public int? PatientAlertID { get; set; }
public int? PriorityID { get; set;…

Zubair Khakwani
- 328
- 5
- 18
0
votes
0 answers
How to Convert a section of an Array C#
I have collected a series of IP's in an array and would like to take those IPs and place them in a var so I can compare them to another string. It should be noted I'm pulling this code from a JSON package.
EDIT: Ok I may have miss-wrote the…

SantaFanta
- 19
- 3
0
votes
1 answer
How to Read a Json from database (SQL) and convert it into a java class?
I have created a column of type varchar(max) in the table in Database using for JSON Auto so that all the columns of that table get's stored as a JSON including Foreign keys also.
Now My Json I created looks like this :
{
"widgetConfiguration":…

Neeharika
- 3
- 3
0
votes
0 answers
.NET NewtonSoft JSON deserialize with different property name
I have the following JSON string which is received from an API and it has the different property name:
{
"countryitems": [
{
"1": {
"ourid": 1,
"title": "AF",
…

Alan John J
- 5
- 3