GithubHelp home page GithubHelp logo

Comments (7)

yoimhere avatar yoimhere commented on June 29, 2024

你好。。。用框架。。。看例子

在 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.

kilolumen avatar kilolumen commented on June 29, 2024

我生成字典后, NSDictionary *dict = [story keyValues];
不能转json

from mjextension.

CoderMJLee avatar CoderMJLee commented on June 29, 2024

能给我看看你的Dict打印出来的结果么

from mjextension.

kilolumen avatar kilolumen commented on June 29, 2024

{
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.

kilolumen avatar kilolumen commented on June 29, 2024

这是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.

kilolumen avatar kilolumen commented on June 29, 2024

是不是key带引号的原因转不了json

from mjextension.

CoderMJLee avatar CoderMJLee commented on June 29, 2024

估计是NSDate和NSSet这种特殊的类型出问题了,这种类型是转不了JSON的,JSON仅仅支持NSString\NSNumber\NSArray\NSDictionary\基本数据类型等

from mjextension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.