Forum Replies Created

  • grigora

    Member
    September 13, 2023 at 12:00 am in reply to: Web interface, JSON

    enlist did the trick, thanks. The following works fine, no need for double .j.j / .j.k

    f1:{enlist (`t1`t2)!(([]c1:`a`b`c;c2:1 2 3);([]c1:`d`e`f;c2:4 5 6))}
    wget http://localhost:5000/test.json?f1` -O test.json
    
    q).j.k raze read0`:test.json
    t1| +`c1`c2!((,"a";,"b";,"c");1 2 3f)
    t2| +`c1`c2!((,"d";,"e";,"f");4 5 6f)

     

  • grigora

    Member
    September 12, 2023 at 12:00 am in reply to: Web interface, JSON

    Thanks, but that doesn’t quite work for my needs. Instead of being able to say http://localhost:5000/.json?callfunc[] and get a JSON, the caller now has to make two requests, one to run the code and save the output on the filesystem, and then another to read the file from html/. And hope there were no requests in between, which can never be guaranteed.

  • grigora

    Member
    September 12, 2023 at 12:00 am in reply to: Web interface, JSON

    Thanks, that’s good to know. However, it only appears to work with plain tables, not other structures, e.g. dictionary of tables.

    f1:{([]c1:`a`b`c;c2:1 2 3)} / works, but you can do the same with CSV
    
    f1:{ (`t1`t2)! (([]c1:`a`b`c;c2:1 2 3);([]c1:`d`e`f;c2:4 5 6)) } / breaks, even though the structure is serializable through JSON
    wget http://localhost:5000/test.json?f1[] -O test.json
    --2023-09-12 15:27:40-- http://localhost:5000/test.json?f1[]
    Resolving localhost (localhost)... 127.0.0.1
    Connecting to localhost (localhost)|127.0.0.1|:5000... connected.
    HTTP request sent, awaiting response... 400 Bad Request
    2023-09-12 15:27:40 ERROR 400: Bad Request.