@@ -331,10 +331,15 @@ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: _value.double_ o]; \ default: \ @throw [OFInvalidFormatException exception]; \ } + +@interface OFNumber (OF_PRIVATE_CATEGORY) +- (OFString*)OF_JSONRepresentationWithOptions: (int)options + depth: (size_t)depth; +@end @implementation OFNumber + (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; @@ -1396,10 +1401,23 @@ return [element autorelease]; } - (OFString*)JSONRepresentation +{ + return [self OF_JSONRepresentationWithOptions: 0 + depth: 0]; +} + +- (OFString*)JSONRepresentationWithOptions: (int)options +{ + return [self OF_JSONRepresentationWithOptions: options + depth: 0]; +} + +- (OFString*)OF_JSONRepresentationWithOptions: (int)options + depth: (size_t)depth { double doubleValue; if (_type == OF_NUMBER_BOOL) return (_value.bool_ ? @"true" : @"false");