reduxjs / redux-devtools

DevTools for Redux with hot reloading, action replay, and customizable UI
http://youtube.com/watch?v=xsSnOQynTHs
MIT License
14.07k stars 1.17k forks source link

Raw output is not a correct json. #1789

Open mdtrooper opened 2 weeks ago

mdtrooper commented 2 weeks ago

I am working in a project from hell that it has a huge redux store and I have tried to copy the copy the store content from Raw to parse with jq, but it fails because the json from Raw is not a correct json.

This is a chunk of my huge redux store:

{
  setting: {
    'ui.resource.download.enable': {
      defaultState: 'false',
      state: 'false',
      error: null,
      status: 'new',
      requests: []
    }
  },
  serverState: {
    info: {
      name: 'FOOBAR',
      version: 'FOOBAR',
      versionType: 'FOOBAR',
      buildDate: 'FOOBAR',
      commit: 'FOOBAR',
      branch: 'FOOBAR'
    }
  },
  coreModuleState: {
    module: 'Core application',
    tabsState: {
      currentTab: 'FOOBAR'
    }
  },

....

And you can see the key for the first branches of json is without double quotes, or the strings have a single quote instead the double quote.

mdtrooper commented 2 weeks ago

At the moment, I have the next workaround:

# Add the double quotes for the json keys
$ sed -E 's/^(\s*)([a-zA-Z0-9_$]+):/\1"\2":/' zzzz.json -i

# Replace single quotes for the strings
sed "s/'/\"/g" zzzz.json -i