洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

9 months ago
  1. //
  2. // NSObject+APBJSON.h
  3. // BioAuthEngine
  4. //
  5. // Created by yukun.tyk on 9/13/16.
  6. // Copyright © 2016 DTF. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @interface NSObject (APBJSON)
  10. /**
  11. * JSON encoder
  12. *
  13. * NSarray只支持一级列表NSInteger, CGFloat, BOOL
  14. *
  15. *
  16. *
  17. * @return JSON string
  18. */
  19. - (NSString *)APBToJSON;
  20. - (NSDictionary *)APBToDict;
  21. - (NSDictionary *)APBToDict:(BOOL)valueCanBeNil;
  22. /**
  23. * JSON decoder
  24. *
  25. * @param json JSON string
  26. *
  27. * NSarray只支持一级列表NSInteger, CGFloat, BOOL
  28. *
  29. *
  30. *
  31. * @return JSON object
  32. */
  33. + (instancetype)APBLoadFromJSON:(NSString *)json;
  34. - (void)APBOverrideFromJSON:(NSString *)json;
  35. - (void)APBOverrideFromJSONData:(NSData *)json;
  36. /**
  37. * JSON encoder
  38. *
  39. * NSarray只支持一级列表NSInteger, CGFloat, BOOL
  40. * canTolerateNil为YES ,value值不存在key所对应的字段做序列化是不存在
  41. * NO,value值为nilnil
  42. * value值为NSData类型
  43. * @return JSON string
  44. */
  45. - (NSString *)classObjectToJSONWithTolerateNilChoice:(BOOL)canTolerateNil;
  46. @end