SBJsonBase

@interface SBJsonBase : NSObject {
  NSMutableArray *errorTrace;
  NSUInteger depth;
  NSUInteger maxDepth;
}

@brief Common base class for parsing & writing.

This class contains the common error-handling code and option between the parser/writer.

  • Undocumented

    Declaration

    Objective-C

    NSMutableArray *errorTrace
  • Undocumented

    Declaration

    Objective-C

    NSUInteger depth
  • Undocumented

    Declaration

    Objective-C

    NSUInteger depth, maxDepth
  • @brief The maximum recursing depth.

    Defaults to 512. If the input is nested deeper than this the input will be deemed to be malicious and the parser returns nil, signalling an error. (Nested too deep.) You can turn off this security feature by setting the maxDepth value to 0.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) NSUInteger maxDepth;

    Swift

    var maxDepth: UInt { get set }
  • @brief Return an error trace, or nil if there was no errors.

    Note that this method returns the trace of the last method that failed. You need to check the return value of the call you’re making to figure out if the call actually failed, before you know call this method.

    Declaration

    Objective-C

    @property (readonly, copy, atomic) NSArray *errorTrace;

    Swift

    var errorTrace: [Any]! { get }
  • @internal for use in subclasses to add errors to the stack trace

    Declaration

    Objective-C

    - (void)addErrorWithCode:(NSUInteger)code description:(NSString *)str;

    Swift

    func addError(withCode code: UInt, description str: String!)
  • @internal for use in subclasess to clear the error before a new parsing attempt

    Declaration

    Objective-C

    - (void)clearErrorTrace;

    Swift

    func clearErrorTrace()