Questions tagged [system.json]
18 questions
5
votes
2 answers
Delphi XE7: How to change a JSON value using System.JSON (versus SuperObject)
I need to load a JSON file, change a value and then write it back to disk.
This is easy using SuperObject, but how do I do the same thing using the System.JSON unit?
const
PathToX =…

Rob
- 155
- 1
- 12
4
votes
2 answers
How to pretty print with System.Json?
Using the new System.Json from 4.5 or the equivalent System.Json for 4.0 from Nuget how do you format the output so it is indented ans spaced in a more readable form?
So this
dynamic jsonObj = new JsonObject();
jsonObj.firstName =…

Simon
- 33,714
- 21
- 133
- 202
4
votes
1 answer
How to serialize a JsonPrimitive inside a JsonValue
I would like to have the next Test passing for all TestCases:
[TestCase("{\"foo\":\"bar\"}")] // [PASS]
[TestCase("C:\\temp")] // [PASS]
[TestCase("Hi \"\"!")] // [FAIL]
[TestCase("{\"\":\"\"}")]…

georgepiva
- 874
- 9
- 29
2
votes
2 answers
Delphi XE 6 using System.JSON methods and implementations failing
I created a simple test app in Delphi XE6, I want to start using Delphi's JSON to handle requests from a custom coded web server (one I am busy with)
procedure TForm1.Button1Click(Sender: TObject);
var
Servermethods : TServerMethods1Client;
…

Ryno Coetzee
- 516
- 4
- 13
2
votes
1 answer
How to Sort a JsonArray
We're using System.JSON to consume an api call and there doesn't seem to be a way to sort the data.
Running in C# ASP.NET 4 and ASP.NET MVC 3.
Here is an example of out data call:
string requestURL = /*URL to the API*/;
WebRequest request =…

Brad Wilkie
- 331
- 4
- 12
1
vote
1 answer
Deserialize JsonValue to model in System.Json
Before anyone start suggesting any libraries like Newtonsoft.Json, System.Text.Json or whatever other nice and simple thing I would love to use, know that I am unable to use anything other than System.Json, because I am working within the…

Frank R. Haugen
- 210
- 3
- 11
1
vote
2 answers
Error CS0433: The type 'JsonValue' exists in both 'System.Json, Version=2.0.5.0' and 'Xamarin.Auth' (CS0433)
I'm trying to create an app in Visual studio for mac with Xamarin.Forms. In this app I'm using Xamarin.Auth to store some user details. Now I want to add a connection with an API by using JSON. I added System.Json and added my code. But the problem…

TruffelNL
- 480
- 5
- 22
1
vote
3 answers
How to check if json array is empty in c#?
I'm calling Google Maps and use System.JSON to parse the object. I grab my object using:
double placeLat = json["results"][0]["geometry"]["location"]["lat"];
Then I want to check wheater the third objects exists and if yes perform some actions, but…

Mac_W
- 2,927
- 6
- 17
- 30
1
vote
2 answers
delphi parse jsonarray with System.JSON
Using Delphi XE8's System.JSON, I cannot parse a jsonarray
Sample Json:
{
"data":{
"current_condition":[
{
"cloudcover":"0",
"FeelsLikeC":"-9",
"FeelsLikeF":"15",
…

Drdead
- 31
- 1
- 1
- 5
1
vote
1 answer
How does one set a property of a JsonObject dynamically?
I am using a method of passing Json to and from my markup using jquery and ajax. This can be described in more detail on this page: http://blogs.telerik.com/aspnet-ajax/posts/12-04-27/the-present-and-future-of-using-json-in-webforms.aspx
In this…

Primalpat
- 374
- 4
- 17
1
vote
1 answer
Extracting JsonObject from JsonArray
I have a problem to extract a JasonObject from a Arry, that contains some objects without a name. Ive got the Array by a batch request form graph.facebook.
[
{
"code":200,
"headers":[{...}],
"body":"{
…

Findus
- 303
- 1
- 4
- 17
0
votes
0 answers
System.Text.Json custom descriminator that isn't the first field?
I have some JSON retrieved from a database that I cannot alter. I want to polymorphically deserialise based on a field in the object. I understand I can supply a custom name via the attribute [JsonPolymorphic(TypeDiscriminatorPropertyName =…

SeeNoWeevil
- 2,549
- 4
- 26
- 39
0
votes
0 answers
Visual Studio versioning is different that what was installed
I am working on a project in C# and multiple times I have installed nuget packages and put the latest version but then I get errors that it can't find a completely different version number.
Here is one nuget package that I had this problem…

mdarby
- 1
0
votes
2 answers
How to properly use System.Json.JsonArray.Contains()
I want to use the System.Json.JsonArray.Contains() to see if my Array contains a specific value. Below is a minimum example. I expect both varibales bar and baz to be true, but they're both false.
nuget package System.Json v4.5 was used.
using…

h3n
- 880
- 1
- 10
- 26
0
votes
1 answer
System.Json depreacted. What is the alternative?
I'm trying to implement a JSON api for my mobile application. Altough many of samples use System.Json, it is deperecated now. What is its current replacment in .NET?

VSB
- 9,825
- 16
- 72
- 145