# PL-Unit problem with JSON terms

**URL:** <https://swi-prolog.discourse.group/t/pl-unit-problem-with-json-terms/2988>\
**Category:** Help!\
**Created:** [October 1, 2020, 1:56pm UTC](https://swi-prolog.discourse.group/t/pl-unit-problem-with-json-terms/2988 "2020-10-01T13:56:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 1, 2020, 2:17pm UTC](https://swi-prolog.discourse.group/t/pl-unit-problem-with-json-terms/2988/2 "2020-10-01T14:17:23Z")

</div>

I have not done more than read your post and noticed that you are having problems using an SWI-Prolog HTTP server to handle JSON. Instead of trying to find and fix your bug, I saw that [Simple Prolog server with JavaScript clien](https://swi-prolog.discourse.group/t/simple-prolog-server-with-javascript-client/2898) is also using JSON and might be a better starting point for what you seek.

Also, again without running any code, in `test_server.plt` noticed that

```prolog
:- use_module(library(http/http_client)).
:- use_module(library(http/json)).

:- include(test_server).

```

is before

```prolog
:- begin_tests(test_server).

```

When I see

```prolog
:- begin_tests(test_server).

```

I think

```prolog
module('test_server',[]).

```

In other words you are wanting the to use modules but you have asked for them outside of the test module.

I would try this:

```prolog
:- begin_tests(test_server).

:- use_module(library(http/http_client)).
:- use_module(library(http/json)).

```

Not sure about what to do with

```prolog
:- include(test_server).

```

but thinking the `test_server` should be put into a module and then also added with use\_module/1

HTH

---

_[View the full topic](https://swi-prolog.discourse.group/t/pl-unit-problem-with-json-terms/2988)._
