VError VJSONWriter::StringifyValue( const VJSONValue& inValue, VString& outString) { VError err = VE_OK; switch( inValue.GetType()) { case JSON_undefined: { outString = VJSONValue::sUndefinedString; break; } case JSON_null: { outString = VJSONValue::sNullString; break; } case JSON_true: { outString = VJSONValue::sTrueString; break; } case JSON_false: { outString = VJSONValue::sFalseString; break; } case JSON_string: { VString s; err = inValue.GetString( s); s.GetJSONString( outString, GetOptions()); break; } case JSON_number: { VReal r( inValue.GetNumber()); err = r.GetJSONString( outString, GetOptions()); break; } case JSON_array: { err = StringifyArray( inValue.GetArray(), outString); break; } case JSON_object: { err = StringifyObject( inValue.GetObject(), outString); break; } default: xbox_assert( false); } return err; }
VError VJSONWriter::StringifyValue( const VJSONValue& inValue, VString& outString) { VError err = VE_OK; switch( inValue.GetType()) { case JSON_undefined: { outString = VJSONValue::sUndefinedString; break; } case JSON_null: { outString = VJSONValue::sNullString; break; } case JSON_true: { outString = VJSONValue::sTrueString; break; } case JSON_false: { outString = VJSONValue::sFalseString; break; } case JSON_string: { VString s; err = inValue.GetString( s); s.GetJSONString( outString, GetOptions()); break; } case JSON_date: { VTime dd; VString s; inValue.GetTime(dd); dd.GetJSONString(s); if ((GetOptions() & JSON_AllowDates) != 0) { outString = "\"!!" + s + "!!\""; } else outString = "\"" + s + "\""; break; } case JSON_number: { VReal r( inValue.GetNumber()); err = r.GetJSONString( outString, GetOptions()); break; } case JSON_array: { err = StringifyArray( inValue.GetArray(), outString); break; } case JSON_object: { err = StringifyObject( inValue.GetObject(), outString); break; } default: xbox_assert( false); } return err; }