X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fjson.h;h=ead3afd01bec45a6618fdb6da217bb06d1269a4d;hb=c1ab48e4f588c0b6429cf741436cb7a794c92539;hp=89d3b0682851a5b1d9f6ed6e907cd7dca6cc4c4f;hpb=ce64f0f685111ac24c7a321ea56d0c3524621df1;p=folly.git diff --git a/folly/json.h b/folly/json.h index 89d3b068..ead3afd0 100644 --- a/folly/json.h +++ b/folly/json.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 Facebook, Inc. + * Copyright 2015 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,6 +64,8 @@ namespace json { , allow_nan_inf(false) , double_mode(double_conversion::DoubleToStringConverter::SHORTEST) , double_num_digits(0) // ignored when mode is SHORTEST + , double_fallback(false) + , parse_numbers_as_strings(false) {} // If true, keys in an object can be non-strings. (In strict @@ -104,6 +106,14 @@ namespace json { // toAppend implementation for floating point for more info double_conversion::DoubleToStringConverter::DtoaMode double_mode; unsigned int double_num_digits; + + // Fallback to double when a value that looks like integer is too big to + // fit in an int64_t. Can result in loss a of precision. + bool double_fallback; + + // Do not parse numbers. Instead, store them as strings and leave the + // conversion up to the user. + bool parse_numbers_as_strings; }; /* @@ -121,6 +131,11 @@ namespace json { void escapeString(StringPiece input, fbstring& out, const serialization_opts& opts); + + /* + * Strip all C99-like comments (i.e. // and / * ... * /) + */ + fbstring stripComments(StringPiece jsonC); } //////////////////////////////////////////////////////////////////////