▲ 10 r/golang
How to check for undefined attributes on JSON?
Hello everybody. I'm creating an rest API using Golang v1.25, Gin v1.10.0, and Validator v10.20.0. I have a PATCH endpoint that when the address attribute is: undefined -> keep the original data; null -> delete the original data; contain something -> replace the original data by the new. Right now I'm using a pointer for it, so I can know when it's null. The problem is that I couldn't find a way to differentiate when the attribute is undefined or null.
Does anyone know a way to check if a specific attribute undefined?
u/SnooSongs6758 — 13 days ago