Create Feature Layer from JSON

581
0
12-15-2019 05:58 PM
AlGrant
New Contributor II

Hello,

I have create a java based tomcat web server with a REST endpoint to serve up JSON with point geometry. The output JSON which is a list of features in a class called Task.

The AJAX call looks like:

function ajaxGetTasks () {
    $.ajax({
        type: 'GET',
        url: 'alltasks',
        dataType: 'json',
        error: function(req, err){ console.log('my message' + err); },
        success: function(data) { console.log(data); }
    });
};
ajaxGetTasks();
The serialized JSON looks like:

[{"id":1,"title":"Test Task","location":{"type":"Point","coordinates":[174.896,-36.829]}}]

How would I get this to a format so it can be added to a Feature Layer? Looks like I might be able 
to call the fromJSON() method, but I am unclear on the details.

Thanks

Al

0 Kudos
0 Replies