On 3/6/16, 11:06 PM, "santanu4ver" <[email protected]> wrote:

>So far using FlexJS SDK HTTPService API coming very strangely behaving to
>me.
>Maybe that is because I don’t know many things which are ‘supposed to’ act
>‘as is’ when FlexJS HTML output. I’m trying to brief in my experience so
>can
>contributors to the SDK can justify if something is wrong or can guide me
>ahead.

Well, most of the examples have just copied the LazyCollection experiment,
which as I described earlier, was intended to show that it was possible to
do lazy conversion of the server response into ValueObjects.  To be
honest, I haven't really tried to see how close we can get to the way the
Flex SDK handles server responses, which is probably what you are used to.

It would be great if you are willing to help us figure out a more
efficient process.  Again, the key principle, is that you have
ValueObject's defined in your code so that when cross-compiled, the Google
Closure Compiler does not rename the properties in your server response.

Our examples actually take the time to convert each item to the
ValueObject, but it might be possible to skip that as long as you have a
ValueObject linked into your app, so that might be a worthwhile experiment
if you have time.  We can go into more detail if you want to try it.

It may be that if you have a ValueObject linked into the app, you can just
take the HTTPService.data or HTTPService.json, make sure it is an array,
and instantiate an ArrayList with that array.  I'm not clear whether you
are actually getting the same data or json in the cross-compiled version
as you are in the SWF version.  If not, we need to figure that out first.


>
>The whole JSON is hosted at here:
>http://www.gadhavitechnologies.com/project/Flex/testData.json
>
>Now my problem is converting these irregular JSON string by
>JSONInputParser
>does not makes sense to me. If I would have a complete JSON string inside
>JSONItemConvert and test it’s super.convertItem(data) in HTML output -
>that
>might make sense to me, and we could able to get specific objects in AS. I
>would like to note again that in many other cases the data structures are
>quite complex, so write a brute logic by string chunking manually could
>drive us in nightmares. How can we get generic AS objects out of JSON data
>and inside any browser platform across Windows or MacOS?

The default JSONInputParser is not very smart and is probably being fooled
by your data.  It is expecting the first "[" to contain the array of data
and the array to have flat data.

In theory, an InputParser could just look for "{", "}" and "," tokens to
determine when it is at the end of a "ValueObject", and that should be
faster than actually asking JSON.parse to convert the whole thing in many
cases.

So, the best approach may be for you to just do the experiment with
getting HTTPService.json and handing it to an ArrayList.  Then we can see
what bugs need to be fixed if that doesn't work.  We want it to work for
data sets that can be converted fast enough to not block the UI thread.

Thanks,
-Alex

Reply via email to