@@ -71,10 +71,12 @@ maxLength: (size_t)maxLength encoding: (of_string_encoding_t)encoding lossy: (bool)lossy; - (const char*)OF_cStringWithEncoding: (of_string_encoding_t)encoding lossy: (bool)lossy; +- (OFString*)OF_JSONRepresentationWithOptions: (int)options + depth: (size_t)depth; @end extern bool of_unicode_to_iso_8859_15(const of_unichar_t*, char*, size_t, bool); extern bool of_unicode_to_windows_1252(const of_unichar_t*, char*, size_t, bool); @@ -1431,10 +1433,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 { OFMutableString *JSON = [[self mutableCopy] autorelease]; /* FIXME: This is slow! Write it in pure C! */ [JSON replaceOccurrencesOfString: @"\\"