Comments (7)
你好。。。用框架。。。看例子
在 2014-09-25 18:10:51,"leevin2014" [email protected] 写道:
使用JSONKit ,NSLog(@"%@", [dict JSONData]); NSLog(@"%@", [dict JSONString]); 结果都未null。
[NSJSONSerialization dataWithJSONObject:[NSDictionary dictionaryWithDictionary:dict] options:NSJSONWritingPrettyPrinted error:nil];
提示Invalid type in JSON write (__NSDate)
—
Reply to this email directly or view it on GitHub.
from mjextension.
我生成字典后, NSDictionary *dict = [story keyValues];
不能转json
from mjextension.
能给我看看你的Dict打印出来的结果么
from mjextension.
{
channel = {
"created_on" = "2014-03-23 09:27:21 +0000";
"detailed_description" = "\U90a3\U4e9b\U6781\Uff08q\U00ed\Uff09\U54c1\Uff08pa\Uff09\U7684\U4eba\U548c\U4e8b";
"display_name" = "\U6781\U54c1";
"order_no" = 11;
slug = bitching;
tag = 0;
"updated_on" = "2014-06-27 08:18:16 +0000";
zid = 13;
};
"channel_id" = 13;
"comment_count" = 16;
"cover_media" = {
flag = 0;
tag = 0;
};
"created_on" = "2014-09-25 03:43:40 +0000";
"episode_count" = 36;
"first_page_ts" = 1411871434985;
followable = 1;
following = 0;
"followship_count" = 52;
hidden = 0;
"last_episode_created_on" = "2014-09-26 11:07:49 +0000";
"query_string" = "channel_id=13";
removable = 1;
score = "704.3436279296875";
source = "\U76f4\U64ad\U515a";
summary = "\U8fd9\U6bb5\U611f\U60c5\U5176\U5b9e\U8fc7\U4e86\U5f88\U4e45\Uff0c\U6252\U51fa\U53bb\U53ea\U4e0d\U8fc7\U65e0\U804a\U7f62\U4e86\Uff0c\U6709\U4eba\U770b\U7684\U8bdd\Uff0cLZ\U4e5f\U662f\U95f2\U6765\U65e0\U4e8b\Uff0c\U5f53\U4e00\U7b11\U8bdd\U8bf4\U7ed9\U5927\U5bb6\U542c\U5566";
tag = 0;
title = "\U6252\U4e0b\U524d\U4efb\U548c\U4ed6\U73b0\U4efb\U8001\U5a46\Uff0c\U633a\U72d7\U8840\U7684";
"updated_on" = "2014-09-28 01:04:01 +0000";
uri = "http://leevin.com/s/38045";
user = {
"avatar_url" = "http://zavatar.u.dlkjsd.com/46361-20140826T143737Z";
"created_on" = "2014-08-26 14:37:18 +0000";
tag = 0;
"updated_on" = "2014-09-27 05:19:49 +0000";
username = Neverpart;
zid = 46361;
};
"user_id" = 46361;
"view_count" = 2282;
zid = 38045;
}
from mjextension.
这是Model类
@Property (nonatomic, retain) NSString *zid;
@Property (nonatomic, retain) NSString *channel_id;
@Property (nonatomic, retain) NSString *user_id;
@Property (nonatomic, retain) NSString *title;
@Property (nonatomic, retain) NSString *uri;
@Property (nonatomic, retain) NSString *source;
@Property (nonatomic, retain) NSNumber *first_page_ts;
@Property (nonatomic, retain) NSNumber *first_page_ts_channel;
@Property (nonatomic, retain) NSNumber *first_page_ts_all;
@Property (nonatomic, retain) NSNumber *first_page_ts_recent;
@Property (nonatomic, retain) NSNumber *read_upto_episode_no;
@Property (nonatomic, retain) NSNumber *score;
@Property (nonatomic, retain) NSDate *updated_on;
@Property (nonatomic, retain) NSDate *created_on;
@Property (nonatomic, retain) NSDate *last_episode_created_on;
@Property (nonatomic, retain) NSNumber *removable;
@Property (nonatomic, retain) NSNumber *followable;
@Property (nonatomic, retain) NSNumber *following;
@Property (nonatomic, retain) NSNumber *has_new;
@Property (nonatomic, retain) NSNumber *comment_count;
@Property (nonatomic, retain) NSNumber *followship_count;
@Property (nonatomic, retain) NSNumber *episode_count;
@Property (nonatomic, retain) NSNumber *view_count;
@Property (nonatomic, retain) NSString *summary;
@Property (nonatomic, retain) NSString *query_string;
@Property (nonatomic, retain) User *user;
@Property (nonatomic, retain) Channel *channel;
@Property (nonatomic, retain) Media *cover_media;
@Property (nonatomic, retain) NSSet *episodes;
@Property (nonatomic, retain) NSSet *activities;
@Property (nonatomic, retain) NSNumber *hidden;
from mjextension.
是不是key带引号的原因转不了json
from mjextension.
估计是NSDate和NSSet这种特殊的类型出问题了,这种类型是转不了JSON的,JSON仅仅支持NSString\NSNumber\NSArray\NSDictionary\基本数据类型等
from mjextension.
Related Issues (20)
- 字典 转 JSONString Crash HOT 6
- +[NSObject(Property) mj_enumerateProperties:] 崩溃 HOT 6
- swift 与 oc 混合,数据是嵌套数组 使用 mj_objectClassInArray 该方法无效,这个怎么解决呢? HOT 2
- 友盟上偶现的一个崩溃信息 ,[MJProperty valueForObject:] + [MJProperty.m : 78],一直排查不到 HOT 14
- 模型转字典,出现问题了 HOT 1
- -[MJProperty setValue:forObject:] + [MJProperty.m : 98] HOT 2
- `
- 4.0.0 版本模型数组转数组时,模型数组有值,使用- (id)mj_JSONObjectWithKeys:(NSArray *)keys 后转化的值为nil HOT 3
- 设置属性缺省值的功能? HOT 1
- iOS 17 上面海量崩溃 HOT 2
- 如果服务器返回double,如0.94,用字符串接收,会变成0.939999999,精度丢失,麻烦看一下 HOT 1
- 不支持二维数组json对象转换为模型
- 父类、子类中都存在嵌套模型的数组,该如何处理 HOT 1
- iOS 17.0.3上,模型中存在UIImange属性且有值时,模型转字典崩溃。 HOT 2
- 1
- 在bugly上崩溃次数较多的问题,没有排查到什么问题
- 关于ios.deployment_target最低版本 HOT 2
- MJ_LOCK 造成线程优先级倒置 HOT 1
- 图片地址数组,转json字符串时,//变成\/ HOT 1
- swift有没有类似MJExtension方便的库 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mjextension.