Skip to content

Guide · Open source

How to use chinese-xinhua: clone the Chinese dictionary JSON data

Updated · written with AI from the project's own documentation and checked against our catalogue data

chinese-xinhua is an open-source repository of Chinese dictionary content stored as JSON files. It holds idioms (成语), words (词语), characters (汉字) and xiehouyu (歇后语, two-part riddles). This guide shows how to get the repository, what each data file contains and what to check before you rely on it.

chinese-xinhuapwxcoo/chinese-xinhua · ★ 11.7k · MIT

Quick start

  1. 1Install git. Make sure git is available on your computer. The README lists no other prerequisites.
  2. 2Clone the repository. Run the clone command from the README to download chinese-xinhua into a local folder.
  3. 3Open the data folder. Go to chinese-xinhua/data/ and find the four JSON files.
  4. 4Parse a file. Load one JSON file, such as idiom.json, with your language's JSON parser to get an array of entries.
  5. 5Check the fields. Print a few entries and confirm the field names match the README before writing code against them.
  6. 6Verify important entries. Cross-check any entry you publish or rely on against an authoritative dictionary.

What does chinese-xinhua contain?

The README says the repository includes 14032 xiehouyu, 16142 Chinese characters, 264434 words and 31648 idioms. The data lives in a data/ folder with four JSON files: idiom.json, word.json, xiehouyu.json and ci.json.

  • idiom.json: 成语 (idioms), with fields such as word, pinyin, explanation, derivation, example and abbreviation
  • word.json: 汉字 (characters), with fields such as word, oldword, strokes, pinyin, radicals and explanation
  • xiehouyu.json: 歇后语 (riddles), with riddle and answer fields
  • ci.json: 词语 (words), with ci and explanation fields
chinese-xinhua/ +- data/ +- idiom.json +- word.json +- xiehouyu.json +- ci.json

How do you get the chinese-xinhua files?

The install method is clone-and-build. The README gives one command to clone the repository. The README does not list any prerequisites, so you only need git to fetch the files. Once cloned, the JSON files are in the data/ folder and can be read with any language that parses JSON.

git clone https://github.com/pwxcoo/chinese-xinhua.git

How do you read the JSON data?

Each file is a JSON array of objects. You can load it with the standard JSON parser in your language and loop over the entries. The README shows the shape of each entry, so check the field names against the actual file before writing code, because the README excerpt is truncated.

For a word game such as an idiom chain, you would load idiom.json, read the word and pinyin fields, and match the last character of one idiom against the first character of the next. The repository does not include game code, so that logic is yours to write.

  • Load data/idiom.json and read the word and pinyin fields
  • Load data/xiehouyu.json and read riddle and answer for quiz tools
  • Load data/word.json for character strokes, radicals and pinyin

What should you check before using the data?

The README says the author collected the data from various websites and wrote scraping scripts, which are included in the repository. It does not state the accuracy of the content or give a source-by-source licence. The repository is MIT licensed, but that licence covers the repository itself, and the README says the data has no commercial purpose and will be removed if infringing.

If you need an official or verified dictionary, this data is not a substitute. Treat it as a convenience lexicon for experiments and check any entries that matter.

What are the known limits?

The changelog says API functionality was taken offline in 2018, so the README's mention of an API is out of date and you should not plan around it. The last recorded change in the changelog is from December 2018, and the project info notes the last push was in December 2023 with no releases.

If you need recent words or updates, this dataset will not keep up with them. Plan to supplement it or maintain your own copy.

What people use it for

  • Building an idiom chain (成语接龙) word game from idiom.json
  • Making a Chinese idiom study list with pinyin and explanations for students
  • Creating a riddle quiz from the xiehouyu.json question and answer pairs
  • Running a basic Chinese NLP experiment that needs a lexicon with pinyin and definitions

Frequently asked questions

How do I install chinese-xinhua?

Clone the repository with git clone https://github.com/pwxcoo/chinese-xinhua.git. The README lists no other prerequisites. The result is a folder with the JSON data files in data/.

Is chinese-xinhua free to use?

The repository is released under the MIT licence, as listed on its project page. The README also says the data was collected from various websites, so check the data's origin before using it in a product.

What does chinese-xinhua require to run?

The project info lists no specific prerequisites. You need git to clone it and a JSON parser in your language to read the files.

Does chinese-xinhua have an API?

No longer. The changelog says API functionality was taken offline in 2018, so you should use the JSON files directly.

Is the chinese-xinhua data accurate?

The README does not state accuracy. It says the author gathered the data from various websites with scripts included in the repository, so verify entries against an authoritative source.

What are alternatives to chinese-xinhua?

The project info lists no comparable projects. For official or verified dictionary content, you would need to look at a licensed or publisher-backed dictionary source.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

chinese-xinhua suits developers, students and NLP experimenters who want a large, free set of Chinese idioms, words, characters and riddles in plain JSON. It is a poor fit if you need verified or officially sourced definitions, a working API, or up-to-date vocabulary.

Install options & downloads