Axios Json-Error (Array)

Hi,

i have a mysql-DB, a php file for reading tables and axios to get the response.

//Variables
data: () => ({
users: [],
userid: 0
}),

With the following code:

axios.get(“ajaxfile.php”).then(function(response) {

   alert(response.data);
});

…i get this result:

[{“id”:“1”,“username”:“Max”,“name”:“Mustermann”,“email”:“muster@muster.de”},{“id”:“2”,“username”:“Peter”,“name”:“Zeuss”,“email”:“zeuss@bla.de”}]

But i cant do it to transform in the variable “users”… i try "this.users=response.data but i doesnt work…

this is my table i will show the data…

<table border="1" width="80%" style="border-collapse: collapse;">
      <tr>
        <th>Username</th>
        <th>Name</th>
        <th>Email</th>
      </tr>

      <tr v-for="user in users" :key="user.id">
        <td>{{ user.username }}</td>
        <td>{{ user.name }}</td>
        <td>{{ user.email }}</td>
      </tr>
    </table>

What am I doing wrong? JSON.parse says it has invalid chars… (the brackets…)

Thanks

Jakan

Have a look at the quotation mark you get. It is not what should be.

var str = '[{"id":“1” ';
alert(str.charCodeAt(2)); // 34 - okey
alert(str.charCodeAt(7)) // 8220 - ???

p.s. If it is not this forum’s formatting