WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
34887
Add API to directly expose JSON parsing
https://bugs.webkit.org/show_bug.cgi?id=34887
Summary
Add API to directly expose JSON parsing
Oliver Hunt
Reported
2010-02-12 04:57:01 PST
Add API to directly expose JSON parsing
Attachments
Patch
(4.13 KB, patch)
2010-02-12 04:59 PST
,
Oliver Hunt
no flags
Details
Formatted Diff
Diff
Patch
(9.11 KB, patch)
2010-03-11 01:00 PST
,
Oliver Hunt
no flags
Details
Formatted Diff
Diff
Patch
(8.85 KB, patch)
2010-03-18 13:38 PDT
,
Oliver Hunt
sam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2010-02-12 04:59:30 PST
Created
attachment 48637
[details]
Patch
Maciej Stachowiak
Comment 2
2010-02-12 05:02:49 PST
Comment on
attachment 48637
[details]
Patch r=me but please put the declaration in a private header until this can go through Mac OS X API review.
Geoffrey Garen
Comment 3
2010-02-12 13:09:02 PST
I think "JSValueMakeFromJSONString" would be a better name than "JSValueMakeValueFromJSONString". All other functions like this are JSValueMake* rather than JSValueMakeValue*. Did you decide to leave out JSValueCreateJSONString, or is that coming in another patch?
Eric Seidel (no email)
Comment 4
2010-02-17 14:23:37 PST
Attachment 48637
[details]
was posted by a committer and has review+, assigning to Oliver Hunt for commit.
Oliver Hunt
Comment 5
2010-02-17 14:24:37 PST
Comment on
attachment 48637
[details]
Patch Clearing review flag, have changed api slightly and have new patch
Oliver Hunt
Comment 6
2010-03-11 01:00:32 PST
Created
attachment 50479
[details]
Patch
Mark Rowe (bdash)
Comment 7
2010-03-11 11:55:22 PST
Comment on
attachment 50479
[details]
Patch
> +/* Converting to and from JSON formatted strings */ > + > +/*! > + @function > + @abstract Creates a JavaScript value from a JSON formatted string. > + @param ctx The execution context to use. > + @param string The JSString containing the JSON string to be parsed. > + @result A JSValue containing the parsed value, or NULL if the input is invalid. > + */ > +JS_EXPORT JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string); > + > +/*! > + @function > + @abstract Creates a JavaScript string containing the JSON serialized representation of a JS value. > + @param ctx The execution context to use. > + @param value The value to serialize. > + @param indent The number of spaces to indent when nesting. If 0, the resulting JSON will not contains newlines. The size of the indent is clamped to 10 spaces. > + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. > + @result A JSString with the result of serialization, or NULL if an exception is thrown. > + */ > +JS_EXPORT JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef value, unsigned indent, JSValueRef* exception);
These two functions need to be tagged in the header with availability macros indicating which version of JavaScriptCore they were introduced with.
> +
Please don’t add trailing white space.
> /*! > @@ -248,7 +270,7 @@ JS_EXPORT JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JS > @result The JSObject result of conversion, or NULL if an exception is thrown. > */ > JS_EXPORT JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception); > - > +
Same here!
Oliver Hunt
Comment 8
2010-03-18 13:38:04 PDT
Created
attachment 51085
[details]
Patch
Eric Seidel (no email)
Comment 9
2010-03-18 13:43:35 PDT
Attachment 51085
[details]
did not build on mac: Build output:
http://webkit-commit-queue.appspot.com/results/1021021
Oliver Hunt
Comment 10
2010-03-18 13:51:31 PDT
Committed
r56189
: <
http://trac.webkit.org/changeset/56189
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug