Closed davidsbond closed 3 years ago
Hello, I'm using sjson to modify the JSON representation of kubernetes objects. Many of them contain this field:
sjson
{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "annotations": { "kubectl.kubernetes.io/last-applied-configuration": "" } }
I want to target the kubectl.kubernetes.io/last-applied-configuration to be deleted by sjson. But it seems like due to the . characters in the key, I'm unable to do this with a normal call to sjson.Delete
kubectl.kubernetes.io/last-applied-configuration
.
sjson.Delete
I've tried both of these:
value, err := sjson.Delete(content, "metadata.annotations.kubectl.kubernetes.io/last-applied-configuration")
value, err := sjson.Delete(content, `metadata.annotations."kubectl.kubernetes.io/last-applied-configuration"`)
But neither result in the field being deleted. Is there a way to perform a deletion on a key that has a full stop in it?
Thanks, great package by the way!
Ah, I should've read the documentation!
I escaped the full stops using a \ character and it works fine!
\
Hello, I'm using
sjson
to modify the JSON representation of kubernetes objects. Many of them contain this field:I want to target the
kubectl.kubernetes.io/last-applied-configuration
to be deleted by sjson. But it seems like due to the.
characters in the key, I'm unable to do this with a normal call tosjson.Delete
I've tried both of these:
But neither result in the field being deleted. Is there a way to perform a deletion on a key that has a full stop in it?
Thanks, great package by the way!