Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/JSON/FutureBasic/json.basic
Normal file
21
Task/JSON/FutureBasic/json.basic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn DoIt
|
||||
ErrorRef err = NULL
|
||||
|
||||
CFStringRef jsonString = @"{ \"foo\": 1, \"bar\": [10, \"apples\"] }"
|
||||
CFDataRef strData = fn StringData( jsonString, NSUTF8StringEncoding )
|
||||
CFTypeRef jsonObj = fn JSONSerializationJSONObjectWithData( strData, NULL, @err )
|
||||
if err then NSLog( @"%@", fn ErrorLocalizedDescription( err ) )
|
||||
NSLog( @"%@\n", jsonObj )
|
||||
|
||||
CfDictionaryRef dict = @{ @"blue": @[@1, @2], @"ocean": @"water"}
|
||||
CFDataRef jsonData = fn JSONSerializationDataWithJSONObject( dict, 0, @err )
|
||||
if err then NSLog( @"%@", fn ErrorLocalizedDescription( err ) )
|
||||
CFStringRef jsonString2 = fn StringWithData( jsonData, NSUTF8StringEncoding )
|
||||
NSLog( @"%@\n", jsonString2 )
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue