⚙ JSON 转 Java PropertiesConvert JSON to Properties
把 JSON 对象展平为 Java .properties 文本(key=value,Unicode 转义可选)。本地处理。Flatten a JSON object into Java .properties text (key=value, optional Unicode escapes). Processed locally.
使用说明与常见问题How-to & FAQ
「JSON 转 Java Properties」是什么?What is the Convert JSON to Properties tool?
把 JSON 对象展平为 Java .properties 文本(key=value,Unicode 转义可选)。本地处理。Flatten a JSON object into Java .properties text (key=value, optional Unicode escapes). Processed locally.
如何使用「JSON 转 Java Properties」?How do I use the Convert JSON to Properties tool?
在「JSON 转 Java Properties」中,把内容粘贴或输入到上方输入框,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「{"a":1,"b":{"c":"hi"}}」,得到「a=1 ⏎ b.c=hi」。In the Convert JSON to Properties: Paste or type into the input box; the result appears below instantly — click "Copy result" to copy it. Example: "{"a":1,"b":{"c":"hi"}}" → "a=1 ⏎ b.c=hi".
数组怎样表示?How are arrays shown?
下标写在方括号里,例如 items[0].name。空数组和空对象写成 key=。Indices go in brackets, e.g. items[0].name. Empty arrays and objects are written as key=.
特殊字符怎么转义?How are special characters escaped?
按 Java .properties 规则:键里的空格、=、:、#、!、点号和方括号前加反斜杠;值开头的空格前加反斜杠;反斜杠、换行、回车、制表符写成 \\、\n、\r、\t。勾选“非 ASCII 用 \u 转义”后,键和值里的非 ASCII 字符都写成 \uXXXX,超出 BMP 的字符(如 😀)写成两个 \u 代理对。Following the Java .properties rules: spaces, =, :, #, !, dots and brackets in keys get a backslash; a leading space in a value gets a backslash; backslash, newline, carriage return and tab become \\, \n, \r and \t. With Escape non-ASCII ticked, non-ASCII characters in keys and values become \uXXXX, and characters beyond the BMP (such as an emoji) become a surrogate pair of two \u escapes.
能原样转回 JSON 吗?Does it round-trip back to JSON?
.properties 没有类型和数组:转回时数字、布尔、null 都会变成字符串(null 变成空字符串),items[0] 会变成名为 items[0] 的键。键名里的点号已转义,用「Properties 转 JSON」读回时会保留为同一个键。No — .properties has no types or arrays: on the way back numbers, booleans and null become strings (null becomes an empty string), and items[0] becomes a key named items[0]. Dots inside key names are escaped, so Convert Properties to JSON reads them back as the same key.
大数字和重复键会怎样?What about big numbers and duplicate keys?
数字按原文保留,不经过 JavaScript 浮点:12345678901234567890、1e400、1.50 原样输出,不会变成 12345678901234567000、Infinity 或 1.5。重复的键按 JSON 规则保留最后一个值,并在结果下方提示是哪个键。语法错误会写出第几行第几列。Numbers are kept exactly as written, with no JavaScript floating-point step: 12345678901234567890, 1e400 and 1.50 come out unchanged instead of 12345678901234567000, Infinity or 1.5. Duplicate keys keep the last value, as JSON parsers do, and a notice below the result names the key. Syntax errors give the line and column.
输入和输出是什么样的?What does the input and output look like?
例如在「JSON 转 Java Properties」中输入 {"a":1,"b":{"c":"hi"}},输出为:a=1 ⏎ b.c=hi(⏎ 表示换行)。For example, the Convert JSON to Properties turns the input {"a":1,"b":{"c":"hi"}} into: a=1 ⏎ b.c=hi (⏎ marks a line break).
有哪些选项可以调整?What options can I adjust?
「JSON 转 Java Properties」的设置:可勾选:「非 ASCII 用 \u 转义」。每次生成结果都按当前设置处理。Settings in the Convert JSON to Properties — tick boxes: "Escape non-ASCII as \u". The result always uses the current settings.
代码或数据会被上传吗?Is my code or data uploaded?
不会。「JSON 转 Java Properties」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The Convert JSON to Properties runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「JSON 转 Java Properties」免费吗?需要注册吗?Is the Convert JSON to Properties free? Do I need an account?
「JSON 转 Java Properties」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Convert JSON to Properties is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.