Niels Giesen <niels.gie...@gmail.com> writes:

> Hi,
>
> Say I've got a sh code block invoking curl to some json api, is it possible
> some way to specify that the format of the output when :results output code
> is in a json code block and *not* a sh code block?
>

Hi Niels,

Currently there is no way to specify the type of returned source code
block.  Hopefully one of Rainer or Rasmus' suggestions to this thread
should serve as a sufficient work around.

I would augment Rainer's solution changing it to the following...

#+begin_src sh :results scalar raw
  echo "#+begin_src json"
    curl 
https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
  echo "#+end_src json"
#+end_src

which works for me -- or presumably would work for me if our-service
could getstfff for dirk with password catsbirthday.

Cheers -- Eric

>
> #+begin_src sh :results output code :exports both
> curl
> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
> #+end_src
>
> #+results:
> #+BEGIN_SRC sh
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> whereas I'd like it to be
>
> #+results:
> #+BEGIN_SRC json
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> Any thoughts on how to go about this? Do other people have this same issue
> and should there come an option in babel that handles this (one language
> outputting source code for another?), or is there a way to specify ones own
> outputter?

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

Reply via email to