I know how to deal with Json and associate such a file with a list:
[ { "key": "Arthur Schopenhauer", "numeroFrasi": 3, "foto" : "images/TEST.jpg", }, { "key": "Nietzsche", "numeroFrasi": 1, "foto" : "images/TEST.jpg", }, .........
But I cannot understand and cannot find on the Internet how to link only all the "frasi" (that is, an array) in a file like this:
[ { "key": "Arthur Schopenhauer", "numeroFrasi": 3, "foto" : "images/TEST.jpg", "frasi": [ "Fras1", "Frase 2 schopenahuer", "Frase 3 schopenhahuer" ] }, { "key": "Nietzsche", "numeroFrasi": 1, "foto" : "images/TEST.jpg", "frasi": [ "Frase 2 nietzsche", "Frase 3 nietzsche" ] }, ...............
My object is not an array, but it is defined as this form, and the txt file is processed using Json:
This is a general definition:
(function () { "use strict"; var list = new WinJS.Binding.List(); var groupedItems = list.createGrouped( function groupKeySelector(item) { return item.group.key; }, function groupDataSelector(item) { return item.group; } ); WinJS.xhr({ url: "/data/frasi.txt" }).then(function (xhr) { var items = JSON.parse(xhr.responseText);
Then this is a specific definition (because when I go to my page, I select only the "element", so only one "key", "number", "foto", "frasi":
WinJS.UI.Pages.define("/pages/itemDetail/itemDetail.html", { ready: function (element, options) { item = options && options.item ? Data.resolveItemReference(options.item) : Data.items.getAt(0);
"resolveItemReference" gets one element from all created elements