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
0
votes
0 answers

TestCaseData attribute does not match when TestCaseData has function call

In the following code, GetTestCaseData is not able to map to ProcessFilterRecords_ReturnsData(). The test explorer does show the yield return value but the debugger never enters ProcessFilterRecords_ReturnsData(). If I pass string directly to…
Abhishek Jain
  • 445
  • 2
  • 6
  • 19
0
votes
0 answers

How to debug into decorator method in C# .net?

I have a class as follows - public class AppSettings { [JsonConverter(typeof(SomeConverter))] public RestApiURL {get; set;} } and SomeConverter method is like - class SomeConverter : JsonConverter { public override bool CanConvert(Type…
0
votes
3 answers

How to write List to Json in scientific notation in c#?

I'm trying to serialize List to json file like this class ScientificDoubleConverter : JsonConverter { public override bool CanRead { get { return true; } } public override bool CanConvert(Type objectType) { return true; } public…
Juri
  • 1,531
  • 2
  • 20
  • 43
0
votes
2 answers

Deserialize JSON array of unnamed arrays using Newtonsoft

I am trying to deserialize a JSON object that has an array of unnamed arrays and am running into some problems. The code I am running to test: var json = "{ \"Triangles\": [[1337],[1338],[1339]]}"; var mesh =…
user1323245
  • 638
  • 1
  • 8
  • 20
0
votes
1 answer

Get JSON string as object at server side and deserialize it

I have a method at a controller which takes an object, And i need to deserialize differently depending on how i create the service at DI. The method is bool SetSnmpRequest(Object obj); Then in the controller public IActionResult…
ATT
  • 921
  • 3
  • 13
  • 30
0
votes
2 answers

C# JsonConvert.DeserializeObject returns a null object

I hope you can help me. I'm trying to deserialize a response object into a dynamic object in C#. The code goes as follow: var result = await message.Content.ReadAsStringAsync(); dynamic response =…
0
votes
1 answer

Using java script functions in node js

I am using the below JS library in order to convert a JSON to XML in NodeJS. XML.ObjTree I created a JS file called XMLJSONParser.js and added the XML.ObjTree content there as below. module.exports = function () { XML.ObjTree = function () { …
Harsha W
  • 3,162
  • 5
  • 43
  • 77
0
votes
2 answers

How to deserialize a class heriting a generic interface dynamically

I have multiple classes extended from an interface and I have a json editor to edit each of those classes that I have in a List, "I" being my interface So let's say I have the variable of the current class which properties have been edited I now…
yeet
  • 25
  • 3
0
votes
1 answer

Deserialize JSON from multiple objects to list of objects

Unable to create mapping object / response model for the received JSON response from the service. Tried of creating custom JsonConverter but could not find any appropriate method which can help to resolve the Deserializing issue The following is the…
0
votes
1 answer

SerializeObject is returning an empty object

JsonConvert.SerializeObject is returning an empty object I can serialize a generic object, and I can serialize this object in a different assembly. I've verified the properties are public and also explicitly marked with json tags. No exception is…
ztorstri
  • 369
  • 6
  • 12
0
votes
0 answers

why httpcontent readasstringasync throws cancelled exception

I'm not sure how much of my code here is relevant in figuring out the problem so I'll start from the top. I use Injection to create an azure web job program and it looks like this: static void Main() { try { //CompositionRoot code…
Bagzli
  • 6,254
  • 17
  • 80
  • 163
0
votes
1 answer

I have a json body which has similar parameters and one different in 3 different situations , how to avoid creating three different bodies

I have a json body with 1 different property in 3 different situations I tried some custom methods but none of them worked. This is my jsonBody var postParameters = new CredoPayRequest() { amount = amount, birthDate =…
LTsetskhla
  • 33
  • 7
0
votes
1 answer

JsonConvert.DeserializeAnonymousType definition syntax issue

I have the following code: var definition = new { result = "", accountinformation = new[] { "" , "" , "" } }; var accountInformationResult = JsonConvert.DeserializeAnonymousType(responseBody, definition); The account information structure comes…
0
votes
0 answers

Adapt JSON to different target systems integrations

Our system outputs a standard key-val JSON but some of our customers have different receiving systems that require different JSON conversions. We are sure this is a common integration issue that was probably handled many time before. Hopefully…
AYBABTU
  • 986
  • 3
  • 17
  • 39
0
votes
1 answer

Why JSON deserializer returns null value when JSON string is not empty?

I am trying to deserialize the following string : {"image":"c:\testimage\test.jpg","predictions":[[0.0000103891,0.0128408,0.914102,0.0000968333,0.0729495]]} I tested this string here and it's decoding is as I wanted. But however, C# function does…
PCG
  • 2,049
  • 5
  • 24
  • 42