Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON response outputs "NULL" instead of null when formatter: 1 #794

Open
1 task done
Raruto opened this issue Mar 26, 2024 · 0 comments
Open
1 task done

JSON response outputs "NULL" instead of null when formatter: 1 #794

Raruto opened this issue Mar 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Raruto
Copy link
Contributor

Raruto commented Mar 26, 2024

Checklist

  • I've searched through the existing issues and this bug has never been reported before

Subject of the issue

Null values are converted to string when sent to HTTP response (formatter: 1) causing an inconsistent handling in JS code:

image

Steps to reproduce

"formatter": 1

// outputs: "NULL"

fetch('https://v37.g3wsuite.it/vector/api/data/qdjango/97/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/', {
  method: 'POST',
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "field": "type|eq|Administrative",
    "formatter": 1,
  }),
}).then(d => d.json()).then(d => console.log(d.vector.data.features[4].properties.subtype))

"formatter": 0

// outputs: null

fetch('https://v37.g3wsuite.it/vector/api/data/qdjango/97/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/', {
  method: 'POST',
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "field": "type|eq|Administrative",
    "formatter": 0,
  }),
}).then(d => d.json()).then(d => console.log(d.vector.data.features[4].properties.subtype))

Environment

[g3wsdk.info]

  • g3w-admin: v3.7.6
  • g3w-client: 3.9.5
  • browser: Firefox 124.0
  • operating system: Windows 10 64-bit

Link to your project

https://v37.g3wsuite.it/en/map/demo-37/

Additional info

No response

@Raruto Raruto added the bug Something isn't working label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants