leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Echo Response Truncated

Yes, the plan is to deliver it with the XML. Why opt out of XML?

  1. Will it not work?
  2. What are the alternatives?
    Please note that this app would need to run both online and offline
Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Echo Response Truncated

The suggestion is to get rid of XML in favor of JSON and describe all items as JSON-structure.

Each structure must contain only it's own piece of data and a link to the next level of the object description in the form of an index in the next level array.

In the correct implementation, the data should be loaded from the network as they are needed. That is, at the beginning the user gets just a list of positions from the Internet. This list could easily be stored inside the application to be able to show it without an Internet connection. After selecting an object the additional information will be requested by this object, and also can be cached in localStorage. These data are then available offline. But bringing all of the content is not the best idea.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Echo Response Truncated

Ok, so ...

  1. How would I convert the xml into JSON as JSON is completely new to me?

  2. codeThis list could easily be stored inside the application to be able to show it without an Internet connection. After selecting an object the additional information will be requested by this object, and also can be cached in localStorage./code
    This app will reside on the phone and will need to be able to rely on getting all data without internet connection needs. Can this be done in JSON?

  3. Examples of how this is done.

    Thanks.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Echo Response Truncated

Hi Leonardo,

  1. http://www.json.org/
  2. Yes
    3) Here is an example:
    codevar names = [
    {name: "Norman Allen", index: 0},
    {name: "Norman Allen2", index: 1},
    ]
    var full_base = [{
    pc: "y",
    th: "Norman_Allen.gif",
    pic: "Norman_Allen.jpg",
    story: "...."
    },
    {
    pc: "y",
    th: "Norman_Allen2.gif",
    pic: "Norman_Allen2.jpg",
    story: "...."
    }]/code
leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Echo Response Truncated

Beautiful! Thanks. As I said before, I am working with very large files. So that's good news if it can work independent of the internet and will load fast by serializing. I'm going to read up on it and get the files converted.

On using JSON
I will get a smaller size of the data to test with first. Then:

  1. In REST service should the Data Type be JSON or JSONP?
    2, Should the Method be Get still?

  2. Will the CDATA[[ used in XML need to be preserved in Json conversion or not?

    On Accessing the Data

  3. Will I still use Echo for this or how would the file be connected to the editor?

  4. Will I just set up one big file and put all the necessary info in variable forms as you have it above? Or would I still be using 2 Rest services in Json file format?

  5. When a name is clicked from names how would I extract the relevant data from full_base?

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Echo Response Truncated

Any info?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Echo Response Truncated

[quote:]

  1. In REST service should the Data Type be JSON or JSONP?
    [/quote]
    json

    [quote:]
    2, Should the Method be Get still?
    [/quote]
    Yes

    [quote:]

  2. Will the CDATA[[ used in XML need to be preserved in Json conversion or not?
    [/quote]
    Take out CDATA

    [quote:]

  3. Will I still use Echo for this or how would the file be connected to the editor?
    [/quote]
    Echo works just like any service. The only difference is that you get the same data each time you invoke it vs getting new data from live service.

    [quote:]

  4. Will I just set up one big file and put all the necessary info in variable forms as you have it above? Or would I still be using 2 Rest services in Json file format?
    [/quote]
    Could be either way.

    [quote:]

  5. When a name is clicked from names how would I extract the relevant data from full_base?
    [/quote]
    You could traverse the JSON, find the record and get the data.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Echo Response Truncated

Thanks, Max. I put the names in this format and then pasted it as Echo. The test is okay but Echo Response gave me again: Incorrect format. Please verify sample response data and try again.
My settings are:

Name: ServiceName
URL:
Method: Get
Data Type: json
Settings: None
Security Context: None
Use Appery Proxy

codevar myNames = [
{
name: "Name 1",
index: 0
},
{
name: "Name 2",
index: 1
},
]
/code

codeYou could traverse the JSON, find the record and get the data./code
I'm at a loss on how to do this with JSON
a) with one single file
b) with a separate rest service
Examples would be appreciated.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Echo Response Truncated

  1. http://www.json.org/
    1. Yes
      3) Here is an example:
      code
      var names = [
      {name: "Name1", index: 0},
      {name: "Name2", index: 1},
      ]
      var full_base = [{
      pc: "y",
      th: "Nam1.gif",
      pic: "Name2.jpg",
      story: "...."
      },
      {
      pc: "y",
      th: "Name2.gif",
      pic: "Nam2.jpg",
      story: "...."
      }]
      /code
maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Echo Response Truncated

Echo has to be valid JSON. You can always check it here: http://jsonlint.com

Return to “Issues”