JSON output from cli

I’m trying to get VIM setup nicely with platformIO, and I’m having an issue with syntastic gcc/cpp linter not finding the header files. (everything else is working through the default Makefile as instructed)

I have to tell gcc where to find the header files, which of course differ per platform/board used. This neomake/neovim plugin gets the include paths from this command: pio -c vim run -t idedata -d $project_dir, which I guess is a decent solution. But it seems like that command is unable to output ONLY the JSON data. It’s always wrapped in verbose stuff like:
========= [SUCCESS] Took 0.47 seconds ============

The neovim plugin I linked above seems to have the same issue, and works around it by looking for { and } to determine the beginning and end of the JSON output. I would like to not do that, and simply get the JSON data.

Is that possible? Can pio or platformio output only JSON? No other messages?

Or, any other way to get VIM/syntastic to cooperate?


This is a right solution to parse JSON from idedata target. Here are a few issues why we do that too. This data come from PIO Build System where it can produce other messages/info in non JSON format.

This target is intended for pio init command when you generate a project for the specific IDE. Please file an issue and maybe we will rewrite this part later.

Please note, that this command can return more than 1 JSON data in case when project contains multiple build environment. Please use -e envname option in this case.

JSON data come in a separate line. See how we parse it:

Thanks. I will do this as well.