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

FR: Output format JSON #190

Open
eopo opened this issue May 1, 2022 · 1 comment
Open

FR: Output format JSON #190

eopo opened this issue May 1, 2022 · 1 comment

Comments

@eopo
Copy link

eopo commented May 1, 2022

Hi,

to be able to process the decoded telegrams more easily and less error-prone, output as JSON would be very handy.
I would therefore like to have an output format flag, that takes in "JSON" as option.

Keep up the great work in this really valuable project.

@lingfish
Copy link

For anyone interested... I've started work on this.

First and foremost -- it's been many, many years since I coded in C, some of this might be a little rough!

I can also see more "optimised" ways of doing this, but it would mean a pretty major refactor that I'm not keen on doing.

Points of note:

  1. It will (eventually) output either the decode, with "demod_name" being the decoded type, or
  2. A JSON struct in the form of {"error": "whatever the error was"} plus keeping the existing error output to file descriptor

A normal struct would look like this:

{
    "demod_name": "POCSAG512",
    "address": 164642,
    "function": 0,
    "alpha": "HbSOME PAGER MESSAGE<NUL><NUL>"
}

An error:

{
    "error": "whatever the error was"
}

It will output in JSON newline-delimited style.

My working branch is here:

https://github.com/lingfish/multimon-ng/tree/add-json

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

2 participants