Skip to main content
26 votes
Accepted

Who is to blame: parsing UTF8 encoded JSON HTTPResponse fails

I'm Riccardo, current developer of URLRead in WL and I have some experience working with encoding in WL. I would like to inform you that this is not a bug. In modern versions of mathematica we have ...
Riccardo Di Virgilio's user avatar
23 votes

Who is to blame: parsing UTF8 encoded JSON HTTPResponse fails

Tracing the evaluation (Mathematica 11.1.1) shows that the string is passed to Developer`ReadRawJSONStream which actually produces the messages: ...
Alexey Popkov's user avatar
13 votes
Accepted

How to export a notebook to Jupyter?

The main point is that Jupyter is a flat structure, but the Notebook is a nested structure. It took me a long time to fully ...
Aster's user avatar
  • 3,846
12 votes
Accepted

Map Values in 'nested' association

I have failed to find a good duplicate so: assoc // Query[All, {"a" -> f}] or MapAt[f, assoc, {All, "a"}]
Kuba's user avatar
  • 137k
11 votes
Accepted

How to parse JSON

The example JSON string: ...
C. E.'s user avatar
  • 70.9k
10 votes

How to export a notebook to Jupyter?

This nb2ipynb function takes the notebook filename as input and it returns a jupyter notebook compatible with JWLS. ...
Fortsaint's user avatar
  • 2,060
9 votes

How to extract a value from an XML tree

So I've figured out how to correctly import json. In my opinion, it's better to explicitly extract such data, field by field. Here you go: ...
swish's user avatar
  • 7,921
9 votes

Efficient JSON parser for Mathematica

Recent versions of Mathematica no longer use Java for parsing JSON, and work very fast. There are at least three ways to read JSON. Import[..., "JSON"] is fast an ...
Szabolcs's user avatar
  • 236k
9 votes
Accepted

Bug with Json payload with diacritics for HTTPRequest

ExportString JSON produces UTF8 encoded json string, if put as HTTPRequest body it will undergo another encoding unless you prevent it with an option: ...
Kuba's user avatar
  • 137k
8 votes
Accepted

How can I generate a graph from a NetworkX JSON

Here's a solution using your example file. Import as RawJSON because this gives us much easier to manipulate associations. ...
Szabolcs's user avatar
  • 236k
8 votes
Accepted

Export inserts unwanted characters

We can recreate this problem more easily with the following code: Export["test.json", "{\"attr1\": \"Sample with `val1`\"}"] What happens is that ...
C. E.'s user avatar
  • 70.9k
8 votes

Bug with Json payload with diacritics for HTTPRequest

I've had luck using the functions WriteRawJSONString and ReadRawJSONString from Developer ...
chuy's user avatar
  • 11.2k
8 votes
Accepted

How can I resolve an unexpected character error when trying to import selected data from a large JSON file?

Any trick to import each line? The key here is to open the file as a stream rather than trying to import it at once. Once you have it open as a stream use ReadLine...
Jason B.'s user avatar
  • 69.2k
8 votes
Accepted

Exporting results containing Entities to JSON?

You can use "ConversionFunction" / "ConversionRules" for ...
Kuba's user avatar
  • 137k
7 votes

Map Values in 'nested' association

...
Henrik Schumacher's user avatar
6 votes

RawJSON vs JSON format

"RawJSON" returns a faithful and reversible representation of JSON, while "JSON" does not. Here's an example: ...
Szabolcs's user avatar
  • 236k
6 votes

Who is to blame: parsing UTF8 encoded JSON HTTPResponse fails

Alexey Popkov's answer is correct. So as to who is to blame, it's Mathematica. The standard requires applications to accept all Unicode characters in strings. Quote from RFC 7159: Section 7: All ...
pj-yn9aq's user avatar
  • 161
6 votes
Accepted

Importing a Part of the JSON

Use the RawJSON Import format. ...
Szabolcs's user avatar
  • 236k
6 votes
Accepted

Converting between XML and JSON?

It's not clear how XML can be converted to JSON in a general way, because how would one deal with attributes? You happen not to have attributes in your XML, but that's just a special case. Luckily, ...
C. E.'s user avatar
  • 70.9k
6 votes
Accepted

Visualize JSON timeseries from Fitbit

The JSON dataset is imported as a list of rules: ...
MarcoB's user avatar
  • 67.5k
6 votes
Accepted

How to export a correct .json file

Floating points are not smaller, they are written in the scientific notation: 1204.8 = 1.2048e3. Nothing wrong with that, it will be parsed correctly. Forward ...
Domen's user avatar
  • 27.8k
6 votes
Accepted

GeoJSON Problems - UK Parliamentary Constituencies

You need to fix a few things here: I'd use GeoGraphics not GeoListPlot. If you insist on GeoListPlot use something like: ...
Vitaliy Kaurov's user avatar
5 votes

Pulling Out Values from JSON Association

First of all, I think you can make your life a bit easier by using RawJSON as input format specification. It basically makes Mathematica use Associations where appropriate when importing JSON. ...
Samuel Novák's user avatar
5 votes
Accepted

How to parse complex response from SDMX-JSON endpoint in Mathematica

Query The answer is in your question, I would suggest to download the whole data parsed in "RawJSON" format and then use ...
rhermans's user avatar
  • 36.9k
5 votes
Accepted

Importing from an API that has non UTF-8 strings

Oh what a mess: ...
Hans's user avatar
  • 956
5 votes

How do I display my weather data in JSON format from Wolfram Mathematica API?

The : is used for named patterns, it's not part of any key-value data structure in Mathematica. You will not find it used in the way you propose anywhere in the ...
C. E.'s user avatar
  • 70.9k
5 votes

Is it possible to grab all the links at once on a webpage?

If you look at the URL that you found, you'll notice a parameter pn. If you change this parameter you get another set of t-shirts. To get all t-shirts you need to ...
C. E.'s user avatar
  • 70.9k
5 votes
Accepted

Using URLFetch/URLExecute to post to an internal server

Lets begin by installing an "internal server". CouchDB is a database that uses the HTTP protocol (no DatabaseLink needed here). It works using REST like many other web services out there. If you are ...
Gustavo Delfino's user avatar
5 votes

Converting between XML and JSON?

I've not been involved with XML lately, but I used to (re)define XMLObject and XMLElement to process an XML structure. It's ...
Michael E2's user avatar
  • 239k
5 votes
Accepted

Openning JSON file, (NDJSON, new line delimited) -- big file

Import[myfile.ndjson,"JSON"] doesn't work because the file as a whole is not valid JSON. But each line is valid JSON and so we can treat the file as a ...
Jason B.'s user avatar
  • 69.2k

Only top scored, non community-wiki answers of a minimum length are eligible