Rabu, 11 Januari 2017

How To Get Data From JSON in NativeScript

Parse and get JSON from url in nativescript is quite simple. I'll show you how to get json data and parse it the show it in android page. Study case: get location detail (IP, Country, City, Region, Latitude, and Longitude) from http://freegeoip.net/json/ and then show it in a page:
How To Get Data From JSON in NativeScript
  1. Make a xml page with one button and 6 label. Please copy and paste this xml script into your xml file:
  2. Then copy and paste the following js script inside the js file:
  3. Done. That the way to get and parse json data in nativescript. Feel free to learn and modified the script by yourself. If you think your method is better than mine, i'll be happy if you share the code with me. Thank you.

Tidak ada komentar:

Posting Komentar