<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/155129>155129</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            -MJ Compilation Database with a single file produces invalid json
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          FaultyPine
      </td>
    </tr>
</table>

<pre>
    Running clang with -MJ on my project, which uses a unity build file, produces the following (truncated for viewing ease) compile_commands.json.
`
{ "directory": "....", "file": "...", "output": "...", "arguments": [........] },
`
Note the trailing comma at the very end there, which breaks most json parsers, like nlohmann/json.
Though in general, the schema for this json is that there should be an _array_ of these command objects, so really this should probably look like
[ { "directory": "....", ......, "arguments": [...] } ]
https://clang.llvm.org/docs/JSONCompilationDatabase.html
"A compilation database is a JSON file, which consist of an array of “command objects”"
 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMlM9u4zYQxp-GugwiyJQVWwcdHLs6LNBt0fYejMiRxA1FGvzjQG9fkFbitECL9cE2-Q1H3_xmKPReTYaoY80Lay4FxjBb1_UYdVh_V4aKwcq1-yMao8wEQqOZ4F2FGZ5-_QbWwLLC1dkfJALjZ3iflZghevKAEI0KKwxRaQmj0pQCrs7KKMhDmAlGq7V9T3kZPwYXjcBAEkbr4KYoC4SeGG9B2OWqNL0KuyxopC9_eGtKVp3Yc5W-Dy_AOJfKkQjWrYxzVp_SVlmWZVrxc1rdbXzRHpKN4RrDf4jopriQCf5Db17K7cOaC7DDhfHzp5vvNlAuMDhUOnNLtgFD3r2RW4GMTAtHD2yDI3zzsFgfIJUHV3SenE8RWr0RGG3nBY1hvP8o_6_ZxmkGZWAiQw51Ck4P8WKmBTPLMCt_T6gS97sLR-BnG7WEgQANvKJzuL6CHZPqCTbSYIfU3GzCW3CEWq_3lNv5q7MDDnoFbe1bNppANC_wU03ZIP4f5o0wsObCqtMcwtWz-sR4z3ifB7LU-raU1k2M99IKz3j_7c_fvp_zzGBQ1lww4ICeyjksOtnj_LTNVNZBbgEJEUI6_Tmy9-YIa7zyIfFBAxlW-s9-4exYsfb8b1zb_iVVUp2gkF0t27rFgrrdoXmuqnq33xVz99wc23Zf7UWNvEEph3Ffi7HFwzAcdxUXhep4xZvqyPcVr9tqVwrE4-4gxDhiLakZ2b6iBZX-pFAo7yN1u6bZ8bbQOJD2-X5zbugdsppsNZfCdenQ0xAnz_aVVj74R5qggqYu3fMvJOED5f0tgOCVmTRlWo_brcwNtZJ56orodPfPrk0qzHEohV0Y79Pztp-nz1dJn12mTm5l3Dr-dwAAAP__twJ9EA">