Questions tagged [jsonparser]

Questions concerned with parsing JSON files using either built-in, third-party or custom built JSON parsers. Questions about implementing JSON parsers are valid too.

Questions concerned with parsing JSON files using either built-in, third-party or custom built JSON parsers. Questions about implementing JSON parsers are valid too.

607 questions
1
vote
1 answer

Issue with Codable and JSON

I'm trying to avoid use all the boilerplate code stuff without codable. I apologize if this a dumb question, but why am I getting this error when I'm trying to parse json with codable? keyNotFound(CodingKeys(stringValue: "name", intValue: nil),…
Havic
  • 99
  • 1
  • 6
1
vote
0 answers

JSON parse auto sort number object keys problem

I have a interesting problem. I am working on an object which returns from my webapi in json format. JSON Object {"3852":20.0,"2852":20.0,"1852":59.0} Above code is my original json code. It is auto-sorted when I run the code below on it,…
muratoner
  • 2,316
  • 3
  • 20
  • 32
1
vote
4 answers

Read JSON file with JSONParser not available in the jarfile

I am trying to read a json file and convert it to the jsonObject and when I searched on how to do it, I came across the method to user JSONParser parser= new JSONParse(); But the version of org.json I am using in the code is "20180803". It does not…
Mano Kugan
  • 207
  • 6
  • 23
1
vote
2 answers

Displaying JSON data to an outlet in swift

I am extremely new to coding and am trying to learn things one step at a time. I have searched through a stack and found some great ideas but nothing that answers what I am hoping to learn. I have created some code that pulls JSON weather data from…
1
vote
2 answers

Decode using JSONDecoder Swift

What is the data model corresponding to the below json? { dog: { type: "dog", logoLocation: "url1" }, pitbull: { type: "pitbull", logoLocation: "url2" } } This is a dictionary of dictionaries So I…
vivin
  • 992
  • 1
  • 8
  • 24
1
vote
1 answer

Parsing comma-separated JSON file

I am trying to use Json.NET to parse a file of comma-separated JSON objects: { JSON ... }, { JSON ... }, { JSON ... } The code below works fine if the stream contains no separators (i.e., commas above removed). However, commas produce an…
Paul Lambert
  • 420
  • 3
  • 10
1
vote
2 answers

Variable inside a variable in Jenkinsfile

What is the correct Jenkinsfile syntax in order to use a variable value when executing command with another variable? For example: def lastItemIndex = "${json.items.size()-1}" def path = "${json.items[${lastItemIndex}].assets.downloadUrl}" echo…
1
vote
1 answer

OpenWeatherMap and Swift 4

I am trying to build a simple weather app using OpenWeatherMap APIs in Swift 4. I can parse Json data in simple cases, but this one has a more complex structure. This is the Json file the API…
1
vote
1 answer

Parsing a .json file (java). trying to get the item from the file, the result is null

Need some help with java+json. My question is about the .json file. When parsing a file, I get null value. There may be a problem in the file itself, or i'm using the wrong parsing path. I have a class PhotocameraDTO: import…
YanaKit
  • 29
  • 3
1
vote
2 answers

Validate the syntax of JSON file in Unix?

Is there way to validate the syntax of a JSON file in Unix and move the invalid files into a error folder. Thanks, Kavin
1
vote
1 answer

JSON.parse( localStorage.getItem('priceSlider')).start , Unexpected end of JSON input

I am using Localstorage.getItem tocreate a RangeSlider with dynamic defaultSelected Values. I am using the rangeSlider inside a react-modal so I need when the user open the model and use the range slider to create a filter, the state is saved in…
1
vote
1 answer

How to Handle Invalid DataType Error in Jersey JAX-RS

I am working on JAX-RS API, where user sending below JSON payload to my API: { "text": "test search", "count": "myvalue" } As mentioned above, count is of type Integer in POJO SearchDetailsInfo.java, but user sending some garbage string in…
Joe
  • 157
  • 1
  • 12
1
vote
2 answers

Json parsing error: type org.json.JSONArray cannot be converted to JSONObject

The JSON is simple as, [{"kw":"48.90","kva":"51.20","pf":"-0.96"}] The error I get is, 08-26 02:28:49.130 13605-13641/com.whatever.emshive E/MainActivity: Response from url: [{"kw":"48.90","kva":"51.20","pf":"-0.96"}] Json parsing error:…
Nishanth Kr
  • 113
  • 2
  • 9
1
vote
2 answers

Parsing nested JSONArrays with Java

I have this ugly JSON string and I need to get the totalStars which in this case is 500. I have tried quite some solutions but none seem to work. This is the JSON: { "code": 200, "message": "success", "data": [ [ { …
Richard
  • 1,087
  • 18
  • 52
1
vote
3 answers

Getting data from json url

I need to write a HTML script which extracts data from a json api and displays it in a table format. The URL is https://rtl2.ods-live.co.uk/api/scheduledJourneys?key=sQ3o5bYbz1&service=&date=2018-08-07&location=039026170002 and I need to pull out…
mushroom126
  • 47
  • 10