+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ return toRef(exec, jsString(exec, string->ustring()));
+}
+
+JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ UString str = string->ustring();
+ if (str.is8Bit()) {
+ LiteralParser<LChar> parser(exec, str.characters8(), str.length(), StrictJSON);
+ return toRef(exec, parser.tryLiteralParse());
+ }
+ LiteralParser<UChar> parser(exec, str.characters16(), str.length(), StrictJSON);
+ return toRef(exec, parser.tryLiteralParse());
+}
+
+JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef apiValue, unsigned indent, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSValue value = toJS(exec, apiValue);
+ UString result = JSONStringify(exec, value, indent);
+ if (exception)
+ *exception = 0;
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ return 0;
+ }
+ return OpaqueJSString::create(result).leakRef();