Checkout for Ionic & Flutter Themes

Parse JSON using Cordova (PhoneGap)


Let's learn about how to parse JSON data using phonegap (cordova). We're going to** read json data using jquery** so we can use getJSON or Ajax method. To get sample json data, i'm gonna read JSON data from

!! Important !!: Please download jquery and use it local to improve performance

create new project

cordova create cordovajson
cd cordovajson

index.html  Let's write a code

    <!DOCTYPE html>
    <html lang="en">

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <script src=""></script>
            $(document).ready(function() {

                $("#makeGetJSONRequest").click(function() {
                    $.getJSON("", function(result) {
                        $.each(, function(i, field) {
                            $("#users").append("- " + field.first_name + " " + field.last_name + "<br/>");

                $("#makeAjaxRequest").click(function() {
                        type: "GET",
                        url: "",
                        crossDomain: true,
                        cache: false,
                        success: function(result) {
                            $.each(, function(i, field) {
                                $("#users").append("- " + field.first_name + " " + field.last_name + "<br/>");

                $("#clear").click(function() {


        <button id="makeGetJSONRequest">using GetJSON</button>
        <button id="makeAjaxRequest">using Ajax()</button>
        <button id="clear">Clear Data</button>
        <div id="users"></div>