We are facing accessing JSON from an file.
We are having the JSON file in the same directory as the HTML file / ENYO script file accessing the JSON file. We are not able to open the file itself.
Can some one please help us with opening and reading contents from an file.
Also if we get an sample how to parse JSON data.
PK.
0 • •
Comments
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •Wish it help you.
- Spam
- Abuse
0 • Off Topic Insightful •We have import this file using code.
And for access the day1 weight We used following code.
var Data = enyo.json.parse(localStorage.getItem('day1'));
But var Data not contains the weight for day1.
So, Can some one please help us and provide correct code for it.
PH.
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •Cut and Paste the json and it will parse it and show you what it can make of it :-)
- Spam
- Abuse
0 • Off Topic Insightful •localStorage doesn't mean "read from a file", it's just another kind of cookie where the browser can store data it got from other means. Using the enyo.Ajax kind to load from a file URL is what you need, but beware that Chrome restricts this a lot unless you start it with the right command line switch.
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •Scott
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •a1=new Array("day1","day2","day3","day4","day5","day6","day7");This is not valid JSON, and you should be seeing an error in your console. Valid JSON would look like this:
{"a1": ["day1","day2","day3","day4","day5","day6","day7"]}Scott
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •dynamically this.items.day+""+i
that means
this.items.day1;
this.items.day2;......
this.items.day7
if some one knows solution for my problem then please send correct code.
- Spam
- Abuse
0 • Off Topic Insightful •this.items["day" + i]- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •I am very new to JSON and ENYO. I am looking for help to turn some JSON info into a list. I have been playing with examples trying to get it to work but still no luck at this point. I don’t know enough to see what I need to change. I wanted to see if there is anyone who could look at what I have at this point and make suggestions. You can look at the live example I am playing with at http://webos.dtechz.com/test1/listtest.html. The example will show what I am trying to get. I need to create a dynamic list from the JSON file. You can also see my current JSON file at http://webos.dtechz.com/test1/listtest.json.
Any help would be greatly appreciated. Also if anyone knows of a tutorial that I could look at to learn JSON that would be great.
This is my current code:
This is my current JSON file:
- Spam
- Abuse
0 • Off Topic Insightful •setupRow. Use a function calledcreatein the main app to make this request. The way you have it set up now, setupRow is never called because there is no data to set up the row with.You should also change that code to:
setupRowshould look something like: .Note there is NO this.render() in this code. And, remember,
console.log()is your friend.- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •But , Its not work ........so please help me .......and correct above code.
The JSON file of weight is wt.json
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •There is a enyo wrapper around localdb:
http://enyojs.com/gallery/#omastudios.Storage
Or a class to ease working with HTML5 SQLite databases in Enyo and beyond:
http://enyojs.com/gallery/#onecrayon.Database
Remember however that localstorage is still not fully developed. WebSQL is not a shared standard (just webkit basedbrowsers). Localstorage is available among the recent browsers (IE,FF,Safari,Chrome,Opera).
Maybe this could be of interest to you, a talk (from 2010 jsconf berlin) about localstorage:
http://blip.tv/jsconfeu/jens-arps-the-hitchhiker-s-guide-to-client-side-persistent-data-storage-4343046
- Spam
- Abuse
0 • Off Topic Insightful •