Deleting fields that contain full stops cannot be deleted
davidsbond opened this issue · comments
Hello, I'm using sjson
to modify the JSON representation of kubernetes objects. Many of them contain this field:
{
"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
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!