/** * Encodes {@code value} to this stringer. * * @param value a finite value. May not be {@link Double#isNaN() NaNs} or * {@link Double#isInfinite() infinities}. * @return this stringer. */ public JsonStringer Value(double value) { if (stack.Count == 0) { throw new JsonException("Nesting problem"); } BeforeValue(); output.Append(JsonObject.NumberToString(value)); return(this); }
/** * Encodes {@code value}. * * @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, * Integer, Long, Double or null. May not be {@link Double#isNaN() NaNs} * or {@link Double#isInfinite() infinities}. * @return this stringer. */ public JsonStringer Value(Object value) { if (stack.Count == 0) { throw new JsonException("Nesting problem"); } if (value is JsonArray) { ((JsonArray)value).WriteTo(this); return(this); } else if (value is JsonObject) { ((JsonObject)value).WriteTo(this); return(this); } BeforeValue(); if (value == null || value == JsonObject.NULL) { output.Append(value); } else if (value is bool) { output.Append(value.ToString().ToLower()); } else if (Json.IsNumber(value)) { output.Append(JsonObject.NumberToString(value)); } else { Str(value.ToString()); } return(this); }