-1

I have object

@interface Hourly (CoreDataProperties)

@property (nullable, nonatomic, retain) NSDate *dt;
@property (nullable, nonatomic, retain) NSNumber *temp;
@property (nullable, nonatomic, retain) NSNumber *temp_min;
@property (nullable, nonatomic, retain) NSNumber *temp_max;
@property (nullable, nonatomic, retain) NSNumber *humidity;
@property (nullable, nonatomic, retain) NSNumber *pressure;
@property (nullable, nonatomic, retain) NSString *main;
@property (nullable, nonatomic, retain) NSString *des;
@property (nullable, nonatomic, retain) NSString *icon;

@end

And url

http://api.openweathermap.org/data/2.5/forecast/dayly?lat=35&lon=139&cnt=2

I can' add json to object by jsonmodel pod because weather in list is a array .

  • Read the pod documentation and figure out how to use it with arrays or use `NSJSONSerialization`, I don't understand what your question is. – A-Live Sep 30 '15 at 16:23

2 Answers2

0

@Ngọc Thái: I don't really understand your question. But, if you want parse from JSON (contain array of objects) to object.

Simple, you can try it: https://github.com/elado/jastor#arrays

Hope this help!

Franken
  • 39
  • 5
0

Try my project BWJSONMatcher. It helps you easily convert a json string to NSArray:

NSArray *dataArray = [BWJSONMatcher matchJSON:YOURJSONSTRING withClass:[Hourly class]];

The library is fully opensourced and under MIT license.

Burrows Wang
  • 249
  • 1
  • 7
  • Obviously if you use a library, especially one that someone just starts spamming all over the place, you have the full responsibility to review the source code and make sure that it actually does what you want. And nothing else. – gnasher729 Nov 10 '15 at 09:06
  • A JSON processor that takes a string as an argument instead of NSData is highly suspicious. – gnasher729 Nov 10 '15 at 09:07
  • The library is fully open sourced and under MIT license. – Burrows Wang Nov 10 '15 at 09:18