This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5529: GUI Composer Saving JSON Data

Part Number: MSP430F5529
Other Parts Discussed in Thread: ENERGIA

Hello,

I am creating a GUI Composer application that can read JSON data being sent from an Energia code that is communicating with a MSP430 Launchpad. I can successfully read and display the JSON data on widgets. Now what i'm trying to do is save the JSON data to a .txt or .csv using GC. is this possible? If so, how?

  • Hi Matt,

    You can do it the hack-y way by opening the logging the messages to the console, or follow this example of appending text to a blob and writing to a file. https://dev.ti.com/gallery/search/Appending 

  • Thank you, this seems similar to another example i tried to make work (dev.ti.com/.../writing_text). I tried following a similar example. Do I need to import any libraries into the javascript code to be able to read the JSON data from the COM port? What needs to be done in the javascript code? there's no option for "value" or "variable" like other simple widgets. This is were I'm having the issue.
  • To solve the problem you need to select "Custom" is the protocol for your project. Then add a new custom codec file to your project. Most of the code will be commented out. Un-comment the encode and decode functions. This will allow you to receive and manipulate the JSON data being sent over the COM port. To display the JSON data you want you will write code inside the decode function inside the "try" loop. To access widgets you have created use the object template "templateObj.$.name_of_your_widget". the JSON data will be in a variable called "jsonObj". You can access specific data using JavaScript notation.

**Attention** This is a public forum