invoice icon indicating copy to clipboard operation
invoice copied to clipboard

Configuration file not parsing correctly.

Open rouilj opened this issue 1 year ago • 5 comments

Using a configuration file formatted like:

{
    "due": "net 30",
    "from": "XYzzY Inc.",
    "to": "ABCD Services",
    "tax": 0.06
}

and a command line:

./invoice generate --import ABCD.json --id "20230703-33" --title "Invoice for June 2023" --item "Addition of Autoresponder" --quantity 10  --rate 75 --discount .10 --item "Phone review of proposal" --quantity 1 --rate -75

I get:

2023/07/04 00:09:12 json file not correctly formatted

with no info as to why it failed. If I run jq . ABCD.json, it passes without error:

{
  "due": "net 30",
  "from": "XYzzY Inc.",
  "to": "ABCD Services",
  "tax": 0.06
}

Using your example input:

{
    "logo": "/path/to/image.png",
    "from": "Dream, Inc.",
    "to": "Imagine, Inc.",
    "tax": 0.13,
    "items": ["Yellow Rubber Duck", "Special Edition Plaid Rubber Duck"],
    "quantities": [5, 1],
    "rates": [25, 25],
}

fails jq because of the trailing ','. If I remove that so jq is happy, I still get the error: 'file is not formatted correctly'.

Ideas?

Thanks.

rouilj avatar Jul 04 '23 00:07 rouilj