Skip to main content

Questions tagged [json.net]

Json.NET (also known as Newtonsoft.Json) is a popular high-performance JSON framework for .NET.

Filter by
Sorted by
Tagged with
4 votes
1 answer
212 views

JSON data converting to Excel File

I have two sets of data coming in from the front end. One is the table header and the other is the table body. the data is in ...
Jefferson's user avatar
  • 353
2 votes
2 answers
124 views

Algorithm to compare OAuth2 Rich Authorization Requests

Authorization Requests spec defines new authorization_details parameter. The authorization server have to somehow compare this parameter to decide whether client ...
Szyszka947's user avatar
5 votes
1 answer
155 views

C# console app to subscribe to Chuck Norris API

I'm a newbie when it comes to programming. I'm working on a console app that subscribes to ChuckNorris JSON API and displays the results. I believe I took into account all possible scenarios. Do you ...
TheChosenOne94's user avatar
2 votes
2 answers
2k views

Created structured/nested JSON from unstructured JSON

I have below unstructured but valid JSON which need to be converted to structured format ...
Pranav Bilurkar's user avatar
2 votes
1 answer
3k views

Json.Net set the value of the Json object by mixed Json path

Code from: https://stackoverflow.com/a/65715088/6859121 It is use a mixed Json path to set Json value. Even if the object on the path does not exist. This code seems to have room for improvement. Is ...
Mr. Squirrel.Downy's user avatar
3 votes
2 answers
124 views

Comparing the keys in multiple JSON files used for translations in an Angular application

I maintain a number of projects, and several of them feature Angular front-ends. These projects need to be available in multiple languages, at the very least French and Dutch and preferably also in ...
BCdotWEB's user avatar
  • 11.2k
4 votes
1 answer
401 views

Parse json manually to POCO classes

I have below json which I need to deserialize in C# - ...
David Todd's user avatar
2 votes
1 answer
184 views

Reload configs in memory basis on a trigger efficiently

(following up from here) I am working on a little project where I need to scan all the config files present in a folder on the disk and load it in memory. Below are the steps: On the disk there is ...
dragons's user avatar
  • 319
6 votes
2 answers
841 views

Scan a directory for files and load it in memory efficiently

I am working on a little project where I need to scan all the files present in a folder on the disk and load it in memory. Below is my code which does that exactly and works fine. Here are the steps: ...
dragons's user avatar
  • 319
1 vote
3 answers
3k views

Code to pass json data with WCF REST POST

I have a WCF REST POST that has JSON data as input, IService.cs: ...
IngTun2018's user avatar
2 votes
1 answer
147 views

Strictly typed JSON representation

I would like to be specific in parameter types or write something like this: Test test = (Json<Test>)"{\"age\": 46}"; Where: ...
Dmitry Nogin's user avatar
  • 6,131
7 votes
0 answers
659 views

Chaining JSON transformations with visitors

I have currently two use-cases that require JSON transformations before it can be deserialized. The first use-case requires changing the custom short type property name from ...
t3chb0t's user avatar
  • 44.3k
5 votes
1 answer
2k views

Adjusting business logic conveniently through JSON and expression trees

I need to evaluate some data. The rules how it should be done are changing frequently (it's an evolving model) so I don't want to rewrite my application each time such a change comes. I'd rather do it ...
t3chb0t's user avatar
  • 44.3k
2 votes
2 answers
13k views

Getting a JObject by a property value

I am building a contact management system. Each contact can relate to the business in one of three ways: client, service provider, and third party. I have a JSON file containing the relation types ...
Michael Haddad's user avatar
4 votes
1 answer
90 views

Preparing tabular data to be sent as json

I query a database and pass the data for processing as a DataTable. After all computations (grouping, filtering, formatting etc.) I need to send it to a Web-Service ...
t3chb0t's user avatar
  • 44.3k
6 votes
1 answer
2k views

Making TypeNameHandling in json.net more convenient

Handling abstract types in json.net can be sometimes challenging because it requires a very long and complex syntax like: ...
t3chb0t's user avatar
  • 44.3k
1 vote
3 answers
2k views

Extracting information from JSON

Here is a simplified version of my JSON. ...
Michael Haddad's user avatar
2 votes
0 answers
41 views

Looping JSON to get matching values from Database

I have a need to take in a payload that looks like this: ...
VinnyGuitara's user avatar
2 votes
1 answer
1k views

Looping JSON in WebAPI Controller and Add new Property

I have a json array that is being passed into a function. Whenever the function comes across a field (call it Field1) in a record with a value that starts with "@!!!@" the function compile them into ...
VinnyGuitara's user avatar
8 votes
2 answers
24k views

Turning a byte array into a C# object whose type is unknown at compile time

I'm trying to turn an array of bytes into a C# object. I only the know the type of the object at runtime. Right now, I'm using the ...
pushkin's user avatar
  • 289
2 votes
2 answers
7k views

Deserialize string into property array of the deserializing type using json.net

I have the input JSON {"QtyEqualsQtyWorked":0,"ReasonCode":"IN"} and my class is ...
Phate01's user avatar
  • 155
1 vote
0 answers
2k views

Custom dictionary class for reading and writing json value to a file

Is my implementation good? The program works as planned, but I wonder if some parts of the code can be made cleaner or more efficient. The file output looks like this: ...
KamRon's user avatar
  • 11
2 votes
1 answer
1k views

Overriding properties at runtime but not for serialization

I have a use case where I need to deserialize some settings from a JSON file and override their values at runtime but when then configuration is saved, I want to keep the original value. Imagine a ...
t3chb0t's user avatar
  • 44.3k
1 vote
1 answer
788 views

Populate DataTable with API results

I am querying an API and populating a C# Datatable with the results, then using a Table Value Parameter to populate a SQL Server table with the results. This is my solution, but it is slow and takes ...
user2676140's user avatar
2 votes
0 answers
833 views

JObject Pattern Matching: Merging partial WEB API JSON payload

This library [GitHub] helps merging partial WEB API JSON payload with existing prepopulated DTO objects. Let's say that JSON is represented by JObject from JSON.NET package. Naïve implementation ...
Dmitry Nogin's user avatar
  • 6,131
13 votes
6 answers
32k views

Valid JSON Test

I'm currently using this method to test a string if it valid JSON. The JToken class depends on Newtonsoft.Json.Linq. ...
Josh's user avatar
  • 305
1 vote
0 answers
2k views

ValidationAttribute to validate a string against a JSON schema

This is my implementation of an .NET ValidationAttribute to validate a string against a JSON schema. The JSON schema file is stored within the application as an ...
James Law's user avatar
  • 497
1 vote
1 answer
639 views

Pool readers and streams with Json.NET

This code is built on Json.NET and gets called hundreds of times per second. My data starts in an ArraySegment<byte>. I wrap that in a ...
Brannon's user avatar
  • 462
8 votes
2 answers
5k views

Reference implementation of HTML-to-JSON converter for PCG

I have opened a puzzle at Programming Puzzles and Code Golf. The question is not perceived well (yet) and one of the reasons is that no reference implementation is provided. To mitigate this ...
Thomas Weller's user avatar
5 votes
2 answers
2k views

Checking for new software updates to the client

I have written a very simple web service with MVC and WebApi. Now I'm working on the client code which will be a WPF application (and soon Windows 8 Store/Phone app). What I have done works, but I'm ...
PEK's user avatar
  • 199
5 votes
1 answer
6k views

Helper class to change property of string when serializing for Json.Net

Is there any way to simplify the following C# helper class to numerate a string for Json.Net? ...
user2151345's user avatar
3 votes
1 answer
102 views

TravelAdvice class

I have never really had to use Json.net until now, so I'm very rusty at it. For that reason, I would appreciate it if someone could have a look over my code and let me know if the way I have done it ...
George Phillipson's user avatar
1 vote
1 answer
28k views

Receiving data from a network stream

I basically have a couple of clients built with C#, using System.Net.Sockets TCP connections connecting to a node server backend. I've looked at tons of examples and everyone seems to receive data in ...
Kyle's user avatar
  • 195
11 votes
2 answers
3k views

NewtonSoft Json.Net serialiser

I'm just starting to develop more in C# after being mainly a VB.NET developer and was looking for someone to critique my implementation of a NewtonSoft Json.Net serialiser. Can you provide some ...
Phil Murray's user avatar