0

I am using JMESPath to query REST Api from a Fortigate Firewall. My query is here:

Licensing.forticare.support.hardware.[expires_r]

Results:

[ "2025-12-04T00:00:00.000Z" ]

How do I remove the T and everything after it so I am only left with a date? I have messed around with replace, but I think I need to convert it to a string before?

At the end of the day I would like the result to look like this:

[ "2025-12-04" ]
  • 1
    _I have messed around with replace_ > what replace? there is nothing like that in JMESPath: https://jmespath.org/specification.html. There is no date or date time concept in JSON, so there Is none in JMESPath either. Your date is already a string. There is [no split function](https://stackoverflow.com/a/74072219/2123530) and slicing [doesn't work on strings](https://github.com/jmespath/jmespath.jep/issues/5), unlike in Python. So for the moment being, you have no JMESPath native way of doing this. – β.εηοιτ.βε Dec 15 '22 at 22:11
  • Ok, thanks! Appreciate the explanation. – ChristopherDill Dec 16 '22 at 04:33

0 Answers0