-1

I'm using $resource to get a JSON object. Now it returned an object with number keys which was expected to be a JSON.

My code:

$resource('url', {
        'param': 1
    }
});

var data = Session.get(function(e) {});

m {0: "[", 1: "{", 2: "s", 3: "h", 4: "o", 5: "p", 6: "I", 7: "d"

Hope to be a string like this:

'[{"shopId":"1","shopName":"name"}]'

enter image description here

Network console seems right. enter image description here

It's worked well with jQuery.

jQuery code:

 $.ajax({
         url: requestUrl,
         type: 'GET',
         dataType: 'json',
         data: {
             'param': 7
         }
 })
Hank
  • 331
  • 1
  • 13

1 Answers1

0

The answer is in the comment.

Phil is right.

Why is your server responding with a quoted JSON string? The response should simply be [{"shopId": ...

Hank
  • 331
  • 1
  • 13