Code Monkey home page Code Monkey logo

Comments (14)

nielsnl68 avatar nielsnl68 commented on July 24, 2024

I need this as well.

from appinventor-sources.

josmas avatar josmas commented on July 24, 2024

@jisqyv FYI there was a bit of work over the summer on a component to do this (qcri project); a data type would be a better option though.

from appinventor-sources.

nielsnl68 avatar nielsnl68 commented on July 24, 2024

I'm not sure why we should need a new data type to store json data in? We have already a function to decode json strings. I think that en need a function like encodes the json data would be enough.

from appinventor-sources.

josmas avatar josmas commented on July 24, 2024

a dictionary data type with utility blocks to read from different types (similar to creating lists from csv) would be more helpful.
In any case, I wouldn't hold my breadth on something like this. Unless you want to chip in and write some code! :)

from appinventor-sources.

halatmit avatar halatmit commented on July 24, 2024

The Web component already has JsonTextDecode. What more would be needed here?

from appinventor-sources.

nielsnl68 avatar nielsnl68 commented on July 24, 2024

a json encode fuction would be nice.

from appinventor-sources.

halatmit avatar halatmit commented on July 24, 2024

We could put in JsonEncode without much effort. App inventor already uses this internally, so it's only a matter of exposing it as a block. Can someone suggest some plausible App Inventor projects that would have a use for Json encoding?

from appinventor-sources.

kkashi01 avatar kkashi01 commented on July 24, 2024

The current implementation returns list [of lists] and then tree traversal can only be accomplished via index. It doesn't allow for value at key search or complex operations.

from appinventor-sources.

halatmit avatar halatmit commented on July 24, 2024

Decoding JSON produces a list structure. To do key search on this structure, use the lookup-in-pairs operation. As an example look at the Food Explorer Tutorial (https://docs.google.com/document/d/1GKobvz1WTBqwV72joTgz1m3icuj_iSoIOTdYFcyKu4U/edit#) which calls a web service to get a JSON response and extracts information from the response.

Or are you asking for something else?

from appinventor-sources.

stevozip avatar stevozip commented on July 24, 2024

I've done a couple of projects using APIs and it's a very clunky procedure to get items buried deep in the list structure that the JSON decoding returns. I'm talking stacks of lookup in pairs blocks to get one item. Unfortunately it's not really easy to extract items buried deep. Most of the time you aren't going to know how deep your desired item is, so you can't use a for loop to get it. Maybe what I would like to see isn't the same as what this topic is discussing, but it would be nice to have an easier way parse a JSON return.

from appinventor-sources.

halatmit avatar halatmit commented on July 24, 2024

Can you say what you would like
(a) in the case where you know the structure of the JSON
(b) in the case where you don't?

I'm not familiar with what people do in other languages.

== Hal Abelson
[email protected]
Prof. of Comp. Sci. and Eng.
MIT Dept. of Elec. Eng. and Comp. Sci.
MIT Media Lab, Second Class Faculty

On Sun, Oct 12, 2014 at 11:44 AM, stevozip [email protected] wrote:

I've done a couple of projects using APIs and it's a very clunky procedure
to get items buried deep in the list structure that the JSON decoding
returns. I'm talking stacks of lookup in pairs blocks to get one item.
Unfortunately it's not really easy to extract items buried deep. Most of
the time you aren't going to know how deep your desired item is, so you
can't use a for loop to get it. Maybe what I would like to see isn't the
same as what this topic is discussing, but it would be nice to have an
easier way parse a JSON return.


Reply to this email directly or view it on GitHub
#96 (comment)
.

from appinventor-sources.

kkashi01 avatar kkashi01 commented on July 24, 2024

Try cheatsheet below. It shows different formats that json can be parsed: https://jqplay.org/

from appinventor-sources.

TravisH84 avatar TravisH84 commented on July 24, 2024

I know this is an old thread, but I am wondering if any progress was made around JSON encoding. In my scenario I want to send parameters from the phone to an arduino device over bluetooth to tell it to move to a specific x,y position, pass GPS info and timestamp information across amongst other things. Having the ability to format JSON through the App Inventor would make my life 100 times easier!

from appinventor-sources.

ewpatton avatar ewpatton commented on July 24, 2024

Resolved by #1982

from appinventor-sources.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.