Busted Unit Tests: can't find json library to match Solar2D

I’m trying to setup some unit tests with http://olivinelabs.com/busted/ outside of Solar2D.

I can’t find a json library which behaves like the one in Solar2D.

  1. It uses . not : for calls (json.decode, json.encode etc)
  2. it has json.prettify

Does anybody know which json library Solar2D uses, and can I install it with luarocks to run with busted?

Here it appears to use dkjson, but this doesn’t have prettify. Is it a custom library?

It looks like prettify is assigned here.

There’s a dkjson.lua in that folder too that differs slightly from the one you cite; I don’t know which one gets used.

Thank you!

To set it up I copied dkjson.lua and the json.lua wrapper from there to my own lib folder within my test environment. Then I said this at the top of my test code:

    -- add root of Solar2D project for my project requires
    package.path = package.path .. ';path/to/solar2D/project/?.lua'

    -- add local lib folder - any solar2D specific requires can be added here
    -- eg modules from https://github.com/coronalabs/corona/tree/master/platform/resources
    package.path = package.path .. ';lib/?.lua'

And when I require 'json' it finds this one in /lib.