No, but it is pretty easy to add one.
In <src> json-parse.h there is a method that is called to parse a V8
string and return a V8 handle. You would have to do the following:
1) Load the file contents into a v8 string
2) Add a function (object method) in v8.h in the includes to take in
your string and return the handle
3) Modify <src> api.cc that looks something like this (note this
method assumes you have opened a scope external to this call):
handle<object> NAME_OF_YOUR_FUNCTION(Handle<String> source)
{
Handle<String> sourceFlatten = Handle<String>(source->TryFlattenGetString());
// Optimized fast case where we only have ASCII characters.
Handle<Object> result;
if (sourceFlatten->IsSeqAsciiString()) {
result = JsonParser<true>::Parse(sourceFlatten);
} else {
result = JsonParser<false>::Parse(sourceFlatten);
}
return result;
}
or something to that effect.
Hope that helps.
-Chris
On Sat, Jun 9, 2012 at 12:57 PM, Guilherme Silva <[email protected]> wrote:
> Hi.
>
> Does v8 has an function that can parse a json file to an object like an
> Handle<Value>?
>
> Thanks ;).
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users