How to edit a JSON file on Android
A game save, an app setting, a test fixture: changing one value in a JSON file sounds trivial until a stray comma makes the whole file unreadable. Here’s how to edit JSON on a phone and keep it valid.
Short answer
Use an app with a tree editor, which can’t introduce a syntax error. In Sonnet, open the file, tap any value to change it, use + to add a field or item, then tap Save. Save writes back to the file you opened, or asks for a name if it’s a new file. If you need to edit the raw text itself, a code editor is the better tool. Sonnet’s code view is read-only.
Get Sonnet free No ads, no account, works offline.
Before you start: keep a copy
If the file belongs to another app (a game, an emulator, a launcher), make a copy before you touch it. Deleting a field can’t be undone in Sonnet, and the app that reads the file may expect exactly the structure it wrote. In your file manager, long-press the file and use Copy, or rename a duplicate to settings.backup.json.
Tree editor or text editor?
| Tree editor (e.g. Sonnet) | Text / code editor | |
|---|---|---|
| How you edit | Tap a value, type the new one | Move the cursor and type characters |
| Syntax errors | Can’t happen: quotes, commas and brackets are written for you | Easy to cause, especially on a phone keyboard |
| Finding a value | Fold away everything you don’t need | Scroll or search the text |
| Fix a broken file | Sonnet repairs missing or extra commas and unclosed brackets as the file opens; anything else has to be fixed as text first | Yes: you can fix any stray character |
| Comments, formatting details | Rewritten on save | Kept exactly as typed |
In short: use a tree editor to change data safely, and a text editor for a file that still won’t open or when you need to keep its exact layout.
Step by step in Sonnet
1. Open the file
Tap the file in your file manager and choose Sonnet under Open with, or tap Open file in the app. It opens in the Tree view: every object and array folds, and every value sits on its own row.
2. Change a value
Tap the value. A sheet opens with the current value. Type the new one and confirm. Strings, numbers and true/false are edited in place, and Sonnet keeps each value’s type: a number field only takes a number.
3. Add a field or item
Tap + on the object or array you want to add to. Enter a key name (objects only), pick a type (String, Number, Boolean, Object, Array or Null), and enter the value. A new Object or Array starts empty, so you can add to it straight away.
Want to change a value’s type, say from the string "42" to the number 42? The simplest way is to delete the field and add it again with the new type.
4. Delete a field
Use the delete button on the row and confirm. This removes the field and everything inside it, and there is no undo. That’s why the backup copy above matters.
5. Save
Tap Save. If you opened an existing file, Sonnet writes your changes back to that same file. If you started with Create File, it asks for a name and then where to save it. Unsaved work on a new file is kept as a draft: Continue editing on the home screen picks it up again.
“Couldn’t save the file”
This almost always means the app that handed you the file only allowed reading it. Chat apps and email attachments often work that way. Your edits are still on screen, so keep them another way:
- Open Share JSON and choose Share with another app to send it as a
.jsonfile, for example to Files or Drive. - Or choose Copy JSON and paste it wherever it needs to go.
Next time, save the attachment to your phone first and open that copy. Opening a JSON attachment shows where each app saves files.
Editing files that belong to other apps
Since Android 11, apps can’t freely read each other’s private folders, so settings files inside Android/data generally aren’t reachable from a file manager or from Sonnet. Files the app deliberately exports, like backups, saves in Downloads or configs in shared storage, are fine. After editing, restart the app that reads the file so it loads the new version.
If the file won’t open in the tree
- “Invalid JSON”: Sonnet already tried to repair the common slips (commas, unclosed brackets), so the error is something else, like a comment or a stray quote inside a string. Fix it as text first. See how to fix invalid JSON.
- Too big for the tree: Sonnet’s tree view handles JSON up to about 2 MB for free, or about 30 MB with Sonnet Pro. Larger files open as read-only formatted text. See large JSON files on Android.
Edit JSON with a tap
Sonnet’s tree editor changes values, adds and deletes fields, and saves valid JSON every time. Offline, no ads, no account. Free on Google Play, with an optional one-time Pro unlock for bigger files and search.