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

Arrays and Objects aren't properly displayed in JSON from terminal #2

Open
tremblaysimon opened this issue May 24, 2021 · 1 comment · May be fixed by #15
Open

Arrays and Objects aren't properly displayed in JSON from terminal #2

tremblaysimon opened this issue May 24, 2021 · 1 comment · May be fixed by #15

Comments

@tremblaysimon
Copy link

The output currently looks like that when we decode from the command line:

[
  {
    resource: {
      resourceType: 'Patient',
      name: [Array],
      birthDate: '1942-01-01',
      gender: 'Male'
    }
  },
  {
    resource: {
      resourceType: 'Immunization',
      vaccineCode: [Object],
      patient: [Object],
      lotNumber: 'EW0193',
      status: 'Completed',
      occurrenceDateTime: '2021-01-01T04:00:00+00:00',
      location: [Object],
      protocolApplied: [Object],
      note: [Array]
    }
  }
]
@tremblaysimon tremblaysimon changed the title Arrays and Objects aren't properly displayed in terminal Arrays and Objects aren't properly displayed in JSON from terminal May 24, 2021
@jitbasemartin
Copy link

Just add a JSON.stringify to line 36, like that:

verifyJWS(scannedJWS).then(
  function (result) {
    return decodeJWS(scannedJWS).then((decoded) => console.log(JSON.stringify(decoded, null, 2)));
  },
  function (e) {
    console.log("Ooooh crap - this looks like a fake vacinnation proof");
  }
);

steven676 referenced this issue in steven676/shc-covid19-decoder Jul 20, 2021
Node.js "helpfully" tries to reduce the amount of output when we pass
the decoded object to console.log(), so we need to pretty-print it
ourselves before displaying.  Fixes #2.
@dlh3 dlh3 linked a pull request Sep 8, 2021 that will close this issue
steven676 referenced this issue in steven676/shc-covid19-decoder Sep 13, 2021
Node.js "helpfully" tries to reduce the amount of output when we pass
the decoded object to console.log(), so we need to pretty-print it
ourselves before displaying.  Fixes #2.  (Thanks to Dave Hughes for the
suggstion to use console.dir() to preserve the color-coding.)
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

Successfully merging a pull request may close this issue.

2 participants