Questions tagged [fromjson]

The fromjson tag should be used in connection with the interpretation of a JSON string as a stringified representation of an arbitrary JSON entity, e.g. "1" as the number 1.

fromjson as a function would convert a JSON string representing an arbitrary JSON document to the corresponding JSON value, e.g "1" to the number 1, "[1]" to the array [1], and so on.

49 questions
0
votes
1 answer

How to handle empty JSON values while using jsonlite::fromJSON?

I'm trying to access an API, which retrieves some data and stores it in a data frame. The following code should be fully reproducible. require("httr") require("jsonlite") require("tidyverse") vouches2 <- data.frame() reproducible_list <-…
luisgonzalez
  • 153
  • 11
0
votes
1 answer

Deriving Aeson type classes with two different possible types in the same field

I have an API which returns JSON results in the following form: { "data": [1, 2, 3] } The data field can be the encoding of two distinct records which are shown below: newtype ResultsTypeA = ResultsTypeA [ResultTypeA] newtype ResultsTypeB =…
Jivan
  • 21,522
  • 15
  • 80
  • 131
0
votes
1 answer

JQ how to read data from inner array with escaping

My json looks like: { "response": { "resNum": 222222, "start": 0, "array": [{ "tr_id": "xx33fg", "user_id": "6678", "x_date": "2021-04-27", "list": [ …
Taras
  • 409
  • 4
  • 18
0
votes
1 answer

Issues getting JSON-stat data to DF (R)

I am trying to download some Covid info (Finland) to R df's with following script. Download is Ok, but No success in conversion to DF. Would appreciate your help! urlcases <-…
JuriJ
  • 1
  • 1
0
votes
1 answer

Get data from JSON in flutter

I am using the following code to verify stock data: Future verifyIfStockSymbolIsValid(String symbol) async { final response = await http.get('https://cloud.iexapis.com/stable/stock/$symbol/quote?token=my-token'); if (response.statusCode…
Timitrov
  • 211
  • 1
  • 3
  • 14
0
votes
3 answers

Dart / Flutter: Mapping json to object having a base class using fromJson in base object

I have two classes: BaseClass (BaseResponse) and DerivedClass (LoginResponse). I am de-serializing them using the fromJson method. I want to understand how can I call the fromJson method for the base class. class BaseResponse { int responseCode; …
Tushar
  • 1,242
  • 1
  • 8
  • 19
0
votes
2 answers

How to avoid PySpark from_json to return an entire null row on csv reading when some json typed columns have some null attributes

I'm actually facing an issue I hope I can explain. I'm trying to parse a CSV file with PySpark. This csv file has some JSON columns. Those Json columns have the same Schema, but are not filled the same way. For instance i have…
0
votes
0 answers

class com.google.gson.internal.LinkedTreeMap cannot be cast to class

I'm having troubles to retrieve an object from a json (using gson). Here is the object's class attributs : abstract class Table { protected ArrayList> table; protected String requete; I put this object in a ArrayList then…
Lapinou
  • 1
  • 1
0
votes
1 answer

Anychart fromJson Errors when setting Line Marker after Chart Draw

I have been looking for a long time why I get error messages when I use the chart lineMarkers. I get a lot of NaN Errors when I hover the mouse over the series point. Today I found out that it has to do with calling the chart.draw() function before…
Synapticon
  • 13
  • 2
0
votes
1 answer

Anychart Standalone Legend Load From JSON

We create our chart with Json using the anychart.fromJson method. So we have methods to build the Json and that's also the way we make our chart legends. Now in certain situations we need these legends as standalone legends. For example when we need…
Synapticon
  • 13
  • 2
0
votes
1 answer

Dart fromJson cannot parse double values

I'm having problem using fromJson in flutter. I'm receiving my data like this {id: d7ba912e-69fd-11ea-9ab0-6597c4120b03, receipt_date: 2020-03-18T17:30:00.000Z, customer_id: e3fedf5e, amount: 2500, remark: Amount 2500, created_on:…
Ryan Paing
  • 137
  • 1
  • 1
  • 7
0
votes
0 answers

fromjson fails to parse scientific notation - Android

When I use Gson().fromJson(objJsonStr, MyClass::class.java) and the string has a long number in scientific notation like 5.83949726077129E9, it fails to handle it and gives exception. How can I make it handle scientific notations as well, without…
M. Usman Khan
  • 3,689
  • 1
  • 59
  • 69
0
votes
2 answers

jq, re-assign field if it is a string with its parsed JSON representation

I have the following JSON: [ { "test": "[\"example\"]" }, { "test": ["example2"] } ] For each object, I want to 1] check if "test" is a string and 2] if test is a string, parse it into an actual JSON array and then re-assign it. So the…
Foobar
  • 7,458
  • 16
  • 81
  • 161
0
votes
1 answer

Get object in json flutter

I have this JSON output (using Chopper library) {"status":"success","error_message":[],"abc":[{"id":"124"},{"id":"125"}]} How can I get the id in object abc ? Response response = await _repo.submitData(title, description); var abcResponse =…
John Joe
  • 12,412
  • 16
  • 70
  • 135
0
votes
1 answer

Parsing Data From JSON file to Java Object using GSON

I have this extremely long JSON file that has a structure like this { "count":123456, "tags":[ { "sameAs":["https://www.wikidata.org/wiki/Q11254"], "url":"https://world.openfoodfacts.org/ingredient/salt", …
Mu'aaz Joosuf
  • 103
  • 1
  • 9