Конвертируйте текст в JSON Array/Object
Tool guide
A list someone pasted into chat, one item per line, is rarely in a shape code can use. Here it becomes JSON: the Mode switch, with Array and Object (key:value), decides whether you get a list of strings or an object built from colon-separated pairs. Blank lines are skipped. Everything is computed in the browser, so internal lists are safe to work on. Useful for database seeds, localisation files and quick fixtures in tests. See also: validate the array you just built, turn the list of lines into a CSV table, parse a delimited file into JSON instead.
There is nothing to split, so such a line is either skipped or yields a key with an empty value. Scan your list before converting and add the missing colons. If the lines genuinely have no keys, switch to Array mode instead, which keeps every line intact as one element of the list.
The split happens at the first colon: everything before it becomes the key, the whole remainder becomes the value. A line reading start: 10:30 gives the key start and the value 10:30, which is normally what you want. A colon inside the key itself is the case that breaks, so avoid it there.
Each line is carried across as text, so 42 comes out as "42" in quotes. That is a deliberate trade-off: automatic typing would ruin SKUs with leading zeros, phone numbers and version strings like 1.10. If you need real types, strip the quotes in your editor afterwards or cast the values in code when loading.
Blank lines between blocks are dropped, which helps when the text was copied out of a formatted document. Leading and trailing spaces or tabs inside an item can survive into the value, though, and later cause a puzzling mismatch in a string comparison. Check the alignment in the finished JSON before shipping it.
That is tabular data, and the CSV to JSON page handles it properly: it distinguishes a header row from a delimiter and builds an array of objects rather than a flat list. Here the separator is always a newline. The quick workaround is to replace the commas with line breaks in any editor and come back.
Yes. Splitting the lines and assembling the JSON is done by a script in the open page; the box contents are not sent to a server and nothing is stored. Reloading the tab clears both boxes. That is why draft localisation strings and internal inventories are reasonable to tidy up here rather than in a third-party service.
Before: Leeds Hull Derby
After: [ "Leeds", "Hull", "Derby" ]
Before: title: Basket empty: Your basket is empty submit: Place order
After: { "title": "Basket", "empty": "Your basket is empty", "submit": "Place order" } Your rating and feedback help decide what to improve next.