I need to get the whole Redux state as a JSON file without payload or action from Redux DevTools, just the state.
Asked
Active
Viewed 3,734 times
3 Answers
11

lecstor
- 5,619
- 21
- 27
-
5This is a valid JS object, but it's not technically valid JSON as the keys need to be strings which need to be surrounded by quotes: https://www.json.org/ – Chase Sandmann Jan 16 '19 at 22:18
-
3when I paste it into my editor and save as *.json it gets formatted correctly (with quotes, etc) 8) – lecstor Jan 19 '19 at 10:38
3
If you're using React, and have React DevTools installed, there's another way to get the state from within Chrome:
Open React DevTools Components tab and select the top level "Provider":
Then go to the Console tab and paste this into the prompt: JSON.stringify($r.store.getState())
$r is the currently selected component in react devtools

denvercoder9
- 801
- 7
- 15
0
- Open Redux devTool => state => raw => Copy all the state
- Open the visual code, create a .json file and paste the state into this new file
- Install "Prettier" extension.
- Right click and choose "Format document with..."
It's done in my case :D

greeneley
- 87
- 7