JSON data from blocks

673 views
Skip to first unread message

Suraj Narwade

unread,
Apr 13, 2017, 12:23:43 PM4/13/17
to Blockly
Hello, 

I am very new to javascript and blockly world. Though I played with scratch and appinventor well. I want to create custom blocks to accept some inputs. After that I want that data in JSON format. I dont want that in Javascript in python for further code.
How can I do that?

Waiting for reply,

Thanks,
Suraj Narwade

Erik Pasternak

unread,
Apr 13, 2017, 1:38:34 PM4/13/17
to Blockly
Hi Suraj,

I'm not sure what you're asking for. Blockly doesn't run user's blocks directly, it generates text code that has to run somewhere else. Are you generating Python code for your Blocks? Are you trying to convert user input into JSON in generated Python code? 

Suraj Narwade

unread,
Apr 14, 2017, 4:03:20 AM4/14/17
to blo...@googlegroups.com
Hey Erik,

Thanks for quick reply.
I am not generating python code but I want to generate YAML file, so I
want to know what blockly do after getting inputs from blocks. is it
JSON or XML.
if its JSON how can I retrieve that JSON for further processing for my app.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Blockly" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> blockly+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Erik Pasternak

unread,
Apr 14, 2017, 12:28:44 PM4/14/17
to Blockly
Blockly takes text in all its inputs. Since it generates code for another language and doesn't run anything directly, any inputs that aren't text have to be defined in the code you're generating or have some custom code that converts it to text for the generator.


> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Erik Pasternak | Master of the House | epas...@google.com     

Suraj Narwade

unread,
Apr 14, 2017, 1:56:05 PM4/14/17
to blo...@googlegroups.com
can you point me towards line of code where it collects all text input
given to blocks ?



On Fri, Apr 14, 2017 at 9:58 PM, 'Erik Pasternak' via Blockly
>> > blockly+u...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Blockly" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> blockly+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Erik Pasternak | Master of the House | epas...@google.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Blockly" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> blockly+u...@googlegroups.com.

Erik Pasternak

unread,
Apr 14, 2017, 2:09:18 PM4/14/17
to Blockly
This is done by the code generators for each block. Check out the Generating code guide for some examples.


>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Blockly" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to

>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Erik Pasternak | Master of the House | epas...@google.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Blockly" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/EwPIPWhMCMY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages