Description
Currently, the only JSON encoding function we use within Icinga 2 is the following that takes an input and returns the full JSON as a string:
Line 14 in 8d607d2
Having another option that can write to some stream similar to json.Encoder
in Go would be desirable (example usage).
The first step for this issue should be to evaluate options on how to best do this in C++. Questions:
- What should the stream type be? Some standard
ostream
? Some Asio stream? Something else? - Is the way we currently generate JSON really the best way? At least when looking at https://github.com/Icinga/icinga2/blob/master/lib/base/json.cpp, my gut feeling is that this does quite some low-level JSON stuff given that we're using a JSON library (emitting JSON tokens, handling pretty printing).