Community discussions

MikroTik App
 
rossigee
just joined
Topic Author
Posts: 4
Joined: Fri Jul 12, 2024 1:25 pm

Feature Request: native JSON parsing function

Fri Jul 12, 2024 1:35 pm

Because everyone having to include huge swathes of unsupported third-party RouterOS functions to do such a common task is not a good look :)

I'm probably not the only one that would really appreciate first-class support for parsing JSON objects in RouterOS scripts.

Thanks, guys!
 
tdw
Forum Guru
Forum Guru
Posts: 1967
Joined: Sat May 05, 2018 11:55 am

Re: Feature Request: native JSON parsing function  [SOLVED]

Fri Jul 12, 2024 4:19 pm

Mikrotik added :serialize and :deserialize commands in v7 which support JSON. I've not tested to see if it handles nested arrays.
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1427
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: Feature Request: native JSON parsing function

Sat Jul 13, 2024 1:46 am

Yes, it does. Look for @Amm0's detailed explanations and examples on the matter.
 
rossigee
just joined
Topic Author
Posts: 4
Joined: Fri Jul 12, 2024 1:25 pm

Re: Feature Request: native JSON parsing function

Sat Jul 13, 2024 6:14 am

Brilliant! Thanks. Not sure why I didn't spot this in the docs earlier.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3840
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Feature Request: native JSON parsing function

Mon Jul 15, 2024 8:52 pm

I have an example of using :serialize/:deserialize with /tool/fetch for the pushover app's JSON API here:
viewtopic.php?t=136256#p1083224
The approach work for most JSON API with a change of the URL used inside the function and different array of data provided.

Who is online

Users browsing this forum: GoogleOther [Bot] and 7 guests