On Tue, 21 Jun 2016 09:24:50 -0700
Anuradha Karuppiah [off-list ref] wrote:
On Tue, Jun 21, 2016 at 9:12 AM, Stephen Hemminger
[off-list ref] wrote:
quoted
On Mon, 20 Jun 2016 23:39:43 -0700
Roopa Prabhu [off-list ref] wrote:
quoted
From: Anuradha Karuppiah <redacted>
This patch adds a type qualifier to json_writer. Type can be a
json object or array. This can be extended to other types like
json-string, json-number etc in the future.
Signed-off-by: Anuradha Karuppiah <redacted>
Since json writer is not used in many places yet, why not just
get rid of the automatic object in the constructor.
I wanted to force the external api to start with an json-object or
json-array. It reduces the chance of mistakes vs. a typeless
constructor. With a typeless constructor you can accidentally end up
with a json output that doesn't pass json lint; especially if optional
params are being suppressed at different places.
Still, this is not how jsonwriter works in .NET, Android, or Java.
It is easily confusing to developers if similar API's behave
differently. Kind of like if printf() always appended a new line
on some platforms.