11

I need to get the whole Redux state as a JSON file without payload or action from Redux DevTools, just the state.

Pushkin
  • 3,336
  • 1
  • 17
  • 30

3 Answers3

11

State -> Raw -> Copy & Paste

Snapshot

lecstor
  • 5,619
  • 21
  • 27
  • 5
    This 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
  • 3
    when 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": React DevTools Components Tab

Then go to the Console tab and paste this into the prompt: JSON.stringify($r.store.getState()) $r.store.getState()

$r is the currently selected component in react devtools

denvercoder9
  • 801
  • 7
  • 15
0
  1. Open Redux devTool => state => raw => Copy all the state
  2. Open the visual code, create a .json file and paste the state into this new file
  3. Install "Prettier" extension.
  4. Right click and choose "Format document with..."

enter image description here

  1. Select "Prettier - Code formatter" enter image description here

It's done in my case :D

greeneley
  • 87
  • 7