Implements #22 JSON output

Introduces a JSON root in every tostring call of
sinsp_evt_formatter regardless.  This may be better to break into
separate calls for the really paranoid.

Otherwise, it derives the key name from the field_info of the token
and then assigns the str value as returned by tostring.

When its done with one round it uses the JSON Fastwriter to return
the std::string back...

The third party JSON-CPP library had one line changed: The fastwriter
part of it would output a newline for us. This was already being handled
and would produce two new lines.  So I removed that from the library.

JSON is a finished standard and I don't expect many "upgrades" to the
library so I think this is a change we can live with.
Changing how newlines are handled

This commit perserves the newline system of the JSON CPP fast-writer
as requested in
https://github.com/draios/sysdig/pull/138#issuecomment-41636808
by instead truncating the last character which we know is going to
be a newline.
Outputs JSON capture objects in a large array

This code introduces an m_first bool to the eventformatter that
represents if its the first tostring call. This is used in order to
emit a '[' or a ',' for a start of an array, or the array delimeter,
respectively.

Also, sinsp_evt_formatter::on_capture_end is introduced, which, for
JSON will emit the trailing ']' representing the end of an array.

This means that an extra clause was put into the g_terminate conditional
inside of do_inspect which will do the on_capture_end of the inspector,
thus emitting the trailing ']'.

Additionally, the JSON::Value and JSON::FastWriter have been moved
to the class scope.
Implements #22 JSON output

Introduces a JSON root in every tostring call of
sinsp_evt_formatter regardless.  This may be better to break into
separate calls for the really paranoid.

Otherwise, it derives the key name from the field_info of the token
and then assigns the str value as returned by tostring.

When its done with one round it uses the JSON Fastwriter to return
the std::string back...

The third party JSON-CPP library had one line changed: The fastwriter
part of it would output a newline for us. This was already being handled
and would produce two new lines.  So I removed that from the library.

JSON is a finished standard and I don't expect many "upgrades" to the
library so I think this is a change we can live with.
Changing how newlines are handled

This commit perserves the newline system of the JSON CPP fast-writer
as requested in
https://github.com/draios/sysdig/pull/138#issuecomment-41636808
by instead truncating the last character which we know is going to
be a newline.
Outputs JSON capture objects in a large array

This code introduces an m_first bool to the eventformatter that
represents if its the first tostring call. This is used in order to
emit a '[' or a ',' for a start of an array, or the array delimeter,
respectively.

Also, sinsp_evt_formatter::on_capture_end is introduced, which, for
JSON will emit the trailing ']' representing the end of an array.

This means that an extra clause was put into the g_terminate conditional
inside of do_inspect which will do the on_capture_end of the inspector,
thus emitting the trailing ']'.

Additionally, the JSON::Value and JSON::FastWriter have been moved
to the class scope.
Merge branch '22-JSON-output' of github.com:kristopolous/sysdig into 22-JSON-output

Conflicts:
	userspace/libsinsp/eventformatter.cpp
Uses numeric long long values for numeric types in JSON output

When the m_print_format of a field is PF_DEC, in JSON output, the
value that is used is now the string representation passed through
atoll.
Uses Booleans and Nulls for their respective values

Adds support for JSON output of both booleans and null values.
Paralleling the tostring to have a symmetric tojson implementation
Better embedded JSON object support.
Better JSON support for time types + Some JSON bugfixes
Numerous JSON type fixes and expansion of file pointers
Re-placing of the comma at the end of the line in JSON format
More consistent JSON naming and better JSON Socket support
Merge branch 'master' into 22-JSON-output
Slight change in flushing rules for JSON to pass the CI
Merge pull request #138 from kristopolous/22-JSON-output

Implements #22 JSON output