00

The short answer

  • JSON is a language-independent text data interchange format that represents structured values, with UTF-8 required for exchange between open systems and parser-dependent limits on numbers and nesting.
  • Open a .json file as text to inspect it, or use a JSON parser to read its structure and check syntax. On Windows or macOS, select it from a text editor's Open dialog. On a phone, use an app that explicitly supports text or JSON and select the file through its file picker. File associations alone do not establish whether the contents are valid JSON.
  • Use a JSON parser for untrusted input. JSON syntax contains neither assignments nor function calls, but parsing with eval or a similar mechanism can execute code. Successful parsing does not establish that the data is trustworthy.
01

JSON files: open, check and convert

JavaScript Object Notation derives from ECMAScript syntax. It supports objects, arrays, strings, numbers, booleans and null. Objects are unordered collections of name/value pairs; arrays are ordered sequences. IANA registers the .json extension and application/json media type, with no fixed magic number.

Keep the original

When converting JSON to Excel or another table format, decide how nested objects and arrays should map to columns, rows or separate tables. Check whether the chosen converter preserves large integers, precise decimals, duplicate keys and array order; these properties may change during reading or conversion.

02

How to open it

Open a .json file as text to inspect it, or use a JSON parser to read its structure and check syntax. On Windows or macOS, select it from a text editor's Open dialog. On a phone, use an app that explicitly supports text or JSON and select the file through its file picker. File associations alone do not establish whether the contents are valid JSON.

I only want to read it

Open a .json file as text to inspect it, or use a JSON parser to read its structure and check syntax. On Windows or macOS, select it from a text editor's Open dialog. On a phone, use an app that explicitly supports text or JSON and select the file through its file picker. File associations alone do not establish whether the contents are valid JSON.

I need to send it to someone

When converting JSON to Excel or another table format, decide how nested objects and arrays should map to columns, rows or separate tables. Check whether the chosen converter preserves large integers, precise decimals, duplicate keys and array order; these properties may change during reading or conversion.

03

File safety

Use a JSON parser for untrusted input. JSON syntax contains neither assignments nor function calls, but parsing with eval or a similar mechanism can execute code. Successful parsing does not establish that the data is trustworthy.

Stop if any of this looks off

An unknown sender, a name ending in two extensions, or contents that do not match the extension — check before you open it.

04

Converting it

When converting JSON to Excel or another table format, decide how nested objects and arrays should map to columns, rows or separate tables. Check whether the chosen converter preserves large integers, precise decimals, duplicate keys and array order; these properties may change during reading or conversion.

Before you convert

Convert a copy, never the original, then compare quality, metadata, and layout against what you started with.

05

Common questions

What is a JSON file used for?

JSON exchanges structured data between applications independently of programming language. Its values can be objects, arrays, strings, numbers, booleans or null.

How do I open a JSON file on Windows?

Use a text editor's Open dialog to select the .json file. To check syntax or read the data structure, use a JSON parser; viewing text alone does not validate it.

How do I open a JSON file on a Mac?

Open the file in a text editor on macOS to inspect its contents. Use a JSON parser when you need syntax checking or structured access to its values.

How do I open a JSON file on a phone?

Choose an app that explicitly supports text or JSON, then select the file through the app's file picker. Supported file sizes and parsing limits depend on the app.

How do I fix JSON syntax errors when a file will not open?

Use the parser's error location to inspect quotes, commas, brackets and value syntax. If the syntax appears correct, check encoding and the parser's size or nesting limits; unpaired UTF-16 surrogates can also cause inconsistent results or runtime failures.

How do I fix garbled Chinese text in a JSON file?

Check that the file is being decoded as UTF-8. JSON exchanged between open systems must use UTF-8, and network-transmitted JSON must not include a byte order mark. Reopening with the correct encoding can help if the original bytes are intact.

What is the difference between JSON and JavaScript code?

JSON is a data format derived from ECMAScript syntax, while JavaScript code can express executable operations. JSON syntax has no assignments or function calls. Use a JSON parser to read data rather than executing it as code.

How can I convert JSON to Excel while preserving nested data?

Choose a converter with documented handling of nested objects and arrays. Decide whether to flatten values into columns, expand arrays into rows or use separate tables. Check the output against the original because preservation depends on the converter and mapping.

How can I avoid JSON large integer precision loss?

Check the number range and precision supported by every parser and converter involved. Implementations may impose limits, so large integers or precise decimals can change during reading or conversion. Compare the resulting values with the original text.

When JSON has duplicate keys, which value is kept?

The result depends on the implementation: some keep only the last value, some report an error and others retain all occurrences. Use unique object names for interoperable exchange.

Is an untrusted JSON file safe to read?

Read it with a JSON parser rather than eval or a similar execution mechanism. JSON syntax does not contain function calls or assignments, but executing untrusted input can run code. Valid syntax does not prove the data is trustworthy.

How large or deeply nested can a JSON file be?

RFC 8259 permits parsers to limit text size and nesting depth, so there is no single supported size for all readers. Check the limits of the parser or app you use.

06

Related formats

Sources

RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format · IETF / RFC Editor,互联网标准

IANA Media Type Registration — application/json · IANA,官方媒体类型登记