Comments (14)
I need this as well.
from appinventor-sources.
@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.
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.
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.
The Web component already has JsonTextDecode. What more would be needed here?
from appinventor-sources.
a json encode fuction would be nice.
from appinventor-sources.
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.
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.
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.
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.
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.
Try cheatsheet below. It shows different formats that json can be parsed: https://jqplay.org/
from appinventor-sources.
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.
Resolved by #1982
from appinventor-sources.
Related Issues (20)
- File ReadPermission/WriterPermission properties have no effect
- UI Properties for Chart Text and Axes HOT 1
- Workspace scrollbar overlaps blocks drawer, Hindering access to last block
- Implement repeat forever HOT 1
- iOS ListView does not accept dictionaries via blocks HOT 3
- "Add" string not translated in component_method block
- iOS companion crashes if ListView SelectionIndex set to be too large
- BlocklyTranslationGenerator.java did not specify the default charset HOT 1
- How to use AISTARTER HOT 1
- [iOS bug] yail/string-replace-mappings-longest-string
- "needs reply to review" label process is broken
- TimePicker in Classic theme crashes with Android 14
- Weird Behaviour of Screen Dropdown HOT 4
- Problem with upload in ai2-test? HOT 4
- Implement a default uncaught exception handler for REPL
- text to speech doesn't produce sound on companion 2.70u HOT 1
- speech recognition does not work on emulator (Mac)
- Inquiry on how to disable downloading of PDFs
- [BUG] Scrollability of Form not respected when ShowStatusBar property is modified.
- Use scheme-specific link in Companion Information dialog
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appinventor-sources.