Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [json.net]

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

4
votes
0answers
69 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 ...
5
votes
1answer
134 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 ...
2
votes
2answers
60 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 ...
4
votes
1answer
57 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 ...
5
votes
1answer
74 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: ...
0
votes
3answers
105 views

Extracting information from JSON

Here is a simplified version of my JSON. ...
2
votes
0answers
18 views

Looping JSON to get matching values from Database

I have a need to take in a payload that looks like this: ...
2
votes
1answer
190 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 ...
7
votes
2answers
3k 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 ...
3
votes
2answers
2k 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 ...
1
vote
0answers
865 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: ...
2
votes
1answer
343 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 ...
0
votes
1answer
237 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 ...
2
votes
0answers
488 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 ...
3
votes
5answers
11k 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. ...
2
votes
0answers
1k 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 ...
1
vote
1answer
300 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 ...
8
votes
2answers
4k 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 ...
5
votes
2answers
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 ...
5
votes
1answer
4k 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? ...
3
votes
1answer
98 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 ...
1
vote
1answer
23k 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 ...
11
votes
2answers
2k 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 ...