# JSON output from maapi\_save\_config

**URL:** <https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053>\
**Category:** Other Northbound Interfaces\
**Created:** [March 6, 2017, 7:03pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053 "2017-03-06T19:03:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![KookyMonster](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@KookyMonster](https://dmap-community.ductus.global/u/KookyMonster)\
**Post date:** [March 6, 2017, 7:03pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/1 "2017-03-06T19:03:38Z")

</div>

I’m trying to save the output of a call to maapi\_save\_config in JSON and despite all APIs suggesting the call succeeded I’m not able to actually retrieve any output after calling “recv” on my stream socket. I’m able to successfully call maapi\_save\_config and retrieve information in all other formats (MAAPI\_CONFIG\_XML, MAAPI\_CONFIG\_XML\_PRETTY, MAAPI\_CONFIG\_J, MAAPI\_CONFIG\_C, MAAPI\_CONFIG\_C\_IOS). Is “MAAPI\_CONFIG\_JSON” supported in ConfD basic?

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [March 6, 2017, 7:43pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/2 "2017-03-06T19:43:50Z")

</div>

JSON output format is supported in ConfD Basic.

You can have a look at the confd\_load command: confd\_load -F o … saves config in JSON-format.

The source code for confd\_load can be found in `<confd_dir>/src/confd/tools`

---

<div class="post-metadata">

**Author:** ![greg](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@greg](https://dmap-community.ductus.global/u/greg)\
**Post date:** [March 6, 2017, 8:07pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/3 "2017-03-06T20:07:26Z")

</div>

But this doesn’t seem to work in ConfD Basic. It could be that since neither REST or WebUI are included in ConfD Basic, that the support for JSON is not included. This does work, as Jonas suggested, in ConfD Premium.

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [March 6, 2017, 8:18pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/4 "2017-03-06T20:18:27Z")

</div>

Scratch that. I had an error in my paths and was running ConfD Premium when I thought I was running ConfD Basic…

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [March 6, 2017, 8:28pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/5 "2017-03-06T20:28:21Z")

</div>

Correct. If I read this ConfD error message correctly ConfD Basic can’t find the rest\_utils Erlang module:

```auto
...
** Reason for termination ==
** {'module could not be loaded',
       [{rest_utils,ikeypath2uri,
            [[['http://tail-f.com/ns/example/dhcpd'|dhcp]],
            ...

```

This module is only available in ConfD Premium.

---

<div class="post-metadata">

**Author:** ![KookyMonster](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@KookyMonster](https://dmap-community.ductus.global/u/KookyMonster)\
**Post date:** [March 7, 2017, 5:28pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/6 "2017-03-07T17:28:50Z")

</div>

Thanks for the responses Jonas and Greg. I had a friend run a quick test for me on his version of premium and it looks like the JSON output is much too slow for my needs anyway so I’ll simply operate on XML data.

For the curious: the particular path in his model that he queried took 37s to response for JSON output and only 1.1 for XML. I need my data in JSON but at those speeds it would be faster for me to do the conversion myself.

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [March 7, 2017, 6:16pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/7 "2017-03-07T18:16:12Z")

</div>

> [@KookyMonster](#):
>
> For the curious: the particular path in his model that he queried took 37s to response for JSON output and only 1.1 for XML. I need my data in JSON but at those speeds it would be faster for me to do the conversion myself.

I believe that according to the benchmark rulebook the curious also deserve a benchmark setup description + YANG model + sample data to be able to reproduce your findings.

---

<div class="post-metadata">

**Author:** ![KookyMonster](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@KookyMonster](https://dmap-community.ductus.global/u/KookyMonster)\
**Post date:** [March 7, 2017, 8:16pm UTC](https://dmap-community.ductus.global/t/json-output-from-maapi-save-config/1053/8 "2017-03-07T20:16:44Z")

</div>

Unfortunately the data model is proprietary and since this was an off-the-cuff test on my behalf I have no idea what the sample data looked like. Even if speed weren’t a factor the inconsistency of being able to only retrieve data using JSON (via maapi\_save\_config) but not set data using JSON (via maapi\_load\_config) is enough to make me revert to manually doing XML \<\> JSON conversions myself. If this is merely an oversight in the manual and you can in fact call maapi\_load\_config with JSON then I might revisit the possibility of using JSON directly. If/when this happens I would be happy to share a more extensive benchmark setup and findings.
