Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw output is not a correct json. #1789

Open
mdtrooper opened this issue Nov 15, 2024 · 1 comment
Open

Raw output is not a correct json. #1789

mdtrooper opened this issue Nov 15, 2024 · 1 comment

Comments

@mdtrooper
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant