× Requests and support related to jBackend.

K2 extra fields - An error occurs when the JSON file is parse (AngularJS).

  • armin.dzubur@gmail.com
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #6709 by armin.dzubur@gmail.com
I use jbackend and plugin for K2 (plg_jbackend_k2_1.3.1_J3).
Articles in K2 use extra fields.
The resulting JSON file is used to view the list of articles in the mobile application online.
The problem is that the key in this JSON file that relates to extra field values is displayed as a number, not as a string

An error occurs when the JSON file is parse (AngularJS).

"extra_fields": {
"0": {
"id": "12",
"name": "Grad",
"value": "Medjugorje",
"type": "textfield",
"group": "4",
"published": "1",
"ordering": "2",
"alias": "Grad"
},
"1": {
"id": "13",
"name": "Postanski broj",
"value": "88269",
"type": "textfield",
"group": "4",
"published": "1",
"ordering": "3",
"alias": "Potanskibroj"

Can, for example, replace string: v0, v1, v2, v3 instead of numbers: 0,1,2,3. Where can I change the code.


"extra_fields": {
"v0": {
"id": "12",
"name": "Grad",
"value": "Medjugorje",
"type": "textfield",
"group": "4",
"published": "1",
"ordering": "2",
"alias": "Grad"
},
"v1": {
"id": "13",
"name": "Postanski broj",
"value": "88269",
"type": "textfield",
"group": "4",
"published": "1",
"ordering": "3",
"alias": "Potanskibroj"

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #6727 by admin
Hi,
so you want to change the plugin to avoid the client side error, right?

I don't think this is easy to do because, as far as I remember, the extra fields are encoded to JSON as-is, without any check on their name.

Can you attach here an example of the JSON response you get? I would like to check if it is a valid JSON, btw.

Kind regards,
Luigi
The following user(s) said Thank You: armin.dzubur@gmail.com

Please Log in or Create an account to join the conversation.

  • armin.dzubur@gmail.com
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #6754 by armin.dzubur@gmail.com
I solved the problem of parsing. Thank you

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #6758 by admin
U're welcome but I did nothing at all :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.184 seconds