// Souffle - A Datalog Compiler
// Copyright (c) 2020, The Souffle Developers. All rights reserved
// Licensed under the Universal Permissive License v 1.0 as shown at:
// - https://opensource.org/licenses/UPL
// - <souffle root>/licenses/SOUFFLE-UPL.txt
// This is a functional test for JSON IO handling.
// JSON output is directed to file.

.type List = [
    head : number,
    tail : List
]
.decl A(x : List)

A(nil).
A([1,nil]).
A([2,[3,nil]]).
.output A(IO=jsonfile,filename="writeA.json")

.type list = [x:number, y:list]
.decl B(a:number, b:list)

B(1,[1,[2,[3,nil]]]).
B(4,nil).
.output B(IO=jsonfile,filename="writeB.json")

.decl C(x : List)
.input C(IO=jsonfile,filename="readA.json")
.output C(IO=jsonfile, format=object)

.decl D(a:number, b:list)
.input D(IO=jsonfile,filename="readB.json")
.output D(IO=jsonfile, format=object)
