Bug 205161

Summary: [GLIB] Add GLib specific API for JSC JSValueRef.h's JSValueMakeFromJSONString and JSValueCreateJSONString methods
Product: WebKit Reporter: Andres Gomez Garcia <agomez>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: agomez, aperez, bugs-noreply, cgarcia, dpino, ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch aperez: review+

Description Andres Gomez Garcia 2019-12-12 07:56:21 PST
JSC provides in its C API functions for JSValueMakeFromJSONString:
https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/API/JSValueRef.h#L300

and JSValueCreateJSONString:
https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/API/JSValueRef.h#L311

It would be great if we could have those exposed by specific new GLib API.
Comment 1 Carlos Garcia Campos 2019-12-16 04:24:32 PST
Created attachment 385749 [details]
Patch
Comment 2 Andres Gomez Garcia 2019-12-19 04:21:29 PST
The API proposed LGTM. Thanks a lot, Carlos!

I've not been able to try it yet, though.
Comment 3 Adrian Perez 2020-01-10 02:50:45 PST
Comment on attachment 385749 [details]
Patch

Patch LGTM. This looks very handy to get data in and out of a JSCContext,
nicer than manually lots of API calls to build complex values. Also if some
JSON comes from somewhere else and is to be loaded into a JSCContext, it
seems much better to have this functionality than loading it as a string
and having to use JSON.parse() later on in the JS side.
Comment 4 Carlos Garcia Campos 2020-01-10 02:53:36 PST
Committed r254331: <https://trac.webkit.org/changeset/254331>
Comment 5 Radar WebKit Bug Importer 2020-01-10 02:54:18 PST
<rdar://problem/58474734>