A
A
Albert Albertov2021-01-07 15:10:17
JSON
Albert Albertov, 2021-01-07 15:10:17

How can I replace unicode \u1111 with cyrillic human-readable characters in a json file?

There is a JSON file in which all Russian letters are replaced with /u[random numbers]. I found on the Internet that these are Unicode character designations. Question: how to automatically replace them with letters (definitely not manually, because there are 4747 lines)? It is necessary to read the written text.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Ezhgurov, 2021-01-07
@albertos1607

1. Use the online decoder. For example, json.parser.online.fr
2. PHP code that converts codes to characters:

$text = json_encode(json_decode($text, false), JSON_UNESCAPED_UNICODE);

V
Valdemar Smorman, 2021-01-15
@smorman

Python 3

import json
import requests

text_data = requests.get('https://...........................').content.decode('unicode-escape', 'ignore')
text_json = json.dumps(text_data)
text_json_load = json.loads(text_json)
print(text_json_load)

And you will have a great Cyrillic instead of \u1111

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question