Questions tagged [jsonconvert]

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.

207 questions
1
vote
1 answer

Decode complex JSON?

I want to decode this complex JSON data into normal String, how can I do that in a simple way?
FGH
  • 2,900
  • 6
  • 26
  • 59
1
vote
2 answers

Parse a Json File - JsonConvert

I have JSON file like: [ 12, [ { "id": "131", "name": "Cate" }, { "id": "132", "name": "Mike" } ], "Result OK" ] And Code: private static void Main(string[] args) { …
1
vote
1 answer

Why is my object not filled up aspdotnet json converters

I have a simple http server. I send some json object over POST At first, I use json converter to parse the json and fill nonserializable objects up public override object ReadJson(JsonReader reader, Type objectType, object existingValue,…
cartuhokni
  • 11
  • 1
1
vote
1 answer

Convert group json for Highcharts Donut chart

This question for creating the Highcharts Donut chart with multiple series. I have dynamic key properties xData, yData of JSON input data model: xData= ["Phase", "Step", "Task"]; yData = ["VPhase", "VStep", "VTask"] inputArray = [ {…
Moslem Shahsavan
  • 1,211
  • 17
  • 19
1
vote
0 answers

Using numerical string keys with json_decode in PHP

I have a JSON string that contains string keys consisting of only numbers, like this: { "a":"b", "1":2, "3":"4" } When I convert this to an associative array using json_decode, PHP interprets the keys as integers and returns this: array ( …
Magnus
  • 17,157
  • 19
  • 104
  • 189
1
vote
2 answers

How to prevent "Date & Time" conversion while converting a json string to XML doc

I want to convert a JSON response to an equivalent XML document but while doing so, I also want to preserve current date and time format along with the offset e.g., DateTime in JSON is "2019-10-25T07:00:00-05:00" and after conversion I want it to…
PumbaTimon
  • 23
  • 4
1
vote
1 answer

Error - cannot convert, not a json string: [type: INPUT_STREAM, value: java.io.BufferedInputStream@5f8890c2 in karate framework

In karate framework, while executing one test case, getting error java.lang.RuntimeException: cannot convert, not a json string: [type: INPUT_STREAM, value: java.io.BufferedInputStream@5f8890c2] at com.intuit.karate.Script.toJsonDoc(Script.java:619)…
Dream_hat
  • 51
  • 5
1
vote
1 answer

VB.NET, keywords as variable names

I have to deserialize some json data string into structure. Problem is that data names conflicts vith VB keywords what is in C# not a case. This is json string: {"id":2526068,"date":"2019-07-21T19:15:17.4468196+02:00","error":""} Problematic…
Wine Too
  • 4,515
  • 22
  • 83
  • 137
1
vote
2 answers

Enum serialization as string without string quotes

I want to serialize enum as string using JSON.NET but I want Enum value to serialize without string quotes [JsonConverter(typeof(StringEnumConverter))] enum Gender { Male, Female } class Test { public Gender { get; set; } …
1
vote
2 answers

Simple serialize ODataQueryOptions

I'm trying to: [EnableQuery] [HttpGet] [ODataRoute("")] public IHttpActionResult Get(ODataQueryOptions options) { var users = _repository.RetrieveOData(); var serialQuery =…
anisanwesley
  • 132
  • 1
  • 9
1
vote
1 answer

Windows services terminating near JsonConvert.DeserializeObject

Below is the code written for window services for copying files. It terminate from line "JsonConvert.DeserializeObject>(jsonStirng);" public static void copyfiles() { getLog("Before querying"); SqlDataReader reader = select(); if…
Suresh Kamrushi
  • 15,627
  • 13
  • 75
  • 90
1
vote
1 answer

How to fix InvalidCastException while using JsonConverter for an IList of Interfaces?

I am trying to create an abstraction layer for Json.NET deserialization using interfaces. To achieve this I use custom JsonConverter which works just fine, until interfaces are introduced. Following exception is thrown: Unhandled Exception:…
meistars
  • 73
  • 1
  • 7
1
vote
2 answers

Newtonsoft.Json.JsonSerializationException: occurred

I'm consuming a rest service but when I de serialize the JSON string it throws this exception? What does this exception mean? Class public class Product { public string PROD { get { return prod; } set { prod = value; } } …
Fatcatfats
  • 43
  • 1
  • 8
1
vote
1 answer

Unable to properly proxy a C# type to client code in an F# WebSharper application

I am experiencing issues when consuming a certain C# type in an F# web application. The following C# type is present in a library I refer to in my F# app: public static class OuterType { public class Model { private readonly string…
Ivaylo Slavov
  • 8,839
  • 12
  • 65
  • 108
1
vote
1 answer

Cosmos DB RequestOptions Serialize/Deserialize Fails with NewtonSoft JsonConvert

I am trying to package a number of parameter objects to send to an Azure Functions HttpTrigger function. Part of the package is a RequestOptions object necessary for Cosmos DB actions. Should be very simple, serialize the object and deserialize on…
Larry Aultman
  • 301
  • 2
  • 10