Miguel Paraz wrote:
> I got the solution by chance. If you make the Javascript VM create a
> new string, by appending a blank string, then this can now be parsed
> as JSON. I don't know why.

A team I was working with ran into this too. In their case, they weren't
even parsing JSON -- they were just using split() or something.

My guess is that Java String objects get exposed to Javascript but are
not turned into actual Javascript strings. For some purposes, the
distinction does not matter, but for others, it does.

What the append-the-blank-string trick does is force the resultant value
to be a Javascript string with the same contents as the original Java
String. Then, everything works normally...if you use the Javascript string.

This used to be common with language integrations. I distinctly remember
having to do the same sort of trick ages ago with strings from C
libraries accessed from Visual Basic, for example.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to