public static function get_root_json(array $children, $op = self::OP_AND, $show = true) {

        // Get the basic object.
        $result = self::get_nested_json($children, $op);

        // Check $op type.
        switch($op) {
            case self::OP_AND:
            case self::OP_NOT_OR:
                $multishow = true;
                break;
            case self::OP_OR:
            case self::OP_NOT_AND:
                $multishow = false;
                break;
        }

        // Add show options depending on operator.
        if ($multishow) {
            if (is_bool($show)) {
                $result->showc = array_pad(array(), count($result->c), $show);
            } else if (is_array($show)) {
                // The JSON will break if anything isn't an actual bool, so check.
                foreach ($show as $item) {
                    if (!is_bool($item)) {
                        throw new \coding_exception('$show array members must be bool');
                    }
                }
                // Check the size matches.
                if (count($show) != count($result->c)) {
                    throw new \coding_exception('$show array size does not match $children');
                }
                $result->showc = $show;
            } else {
                throw new \coding_exception('$show must be bool or array');
            }
        } else {
            if (!is_bool($show)) {
                throw new \coding_exception('For this operator, $show must be bool');
            }
            $result->show = $show;
        }

        return $result;
    }