/*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef FOLLY_JSON_H_
#define FOLLY_JSON_H_
-#include "folly/dynamic.h"
-#include "folly/FBString.h"
-#include "folly/Range.h"
+#include <folly/dynamic.h>
+#include <folly/FBString.h>
+#include <folly/Range.h>
namespace folly {
, pretty_formatting(false)
, encode_non_ascii(false)
, validate_utf8(false)
+ , allow_trailing_comma(false)
+ , sort_keys(false)
+ , skip_invalid_utf8(false)
+ , allow_nan_inf(false)
+ , double_mode(double_conversion::DoubleToStringConverter::SHORTEST)
+ , double_num_digits(0) // ignored when mode is SHORTEST
{}
// If true, keys in an object can be non-strings. (In strict
// Check that strings are valid utf8
bool validate_utf8;
+
+ // Allow trailing comma in lists of values / items
+ bool allow_trailing_comma;
+
+ // Sort keys of all objects before printing out (potentially slow)
+ bool sort_keys;
+
+ // Replace invalid utf8 characters with U+FFFD and continue
+ bool skip_invalid_utf8;
+
+ // true to allow NaN or INF values
+ bool allow_nan_inf;
+
+ // Options for how to print floating point values. See Conv.h
+ // toAppend implementation for floating point for more info
+ double_conversion::DoubleToStringConverter::DtoaMode double_mode;
+ unsigned int double_num_digits;
};
/*
* Parse a json blob out of a range and produce a dynamic representing
* it.
*/
+dynamic parseJson(StringPiece, json::serialization_opts const&);
dynamic parseJson(StringPiece);
/*