<commit_before>/**
 * This file is part of the CernVM File System.
 */

#ifndef CVMFS_JSON_DOCUMENT_WRITE_H_
#define CVMFS_JSON_DOCUMENT_WRITE_H_

#include <cstdio>
#include <string>
#include <vector>

#include "util/exception.h"
#include "util/string.h"

#ifdef CVMFS_NAMESPACE_GUARD
namespace CVMFS_NAMESPACE_GUARD {
#endif

/**
 * This class is used for marshalling JSON objects to strings.
 * When adding an object, use the Quoted variant when adding a
 * string and the Unquoted variant when adding anything else.<commit_msg>update comment on usage<commit_after>/**
 * This file is part of the CernVM File System.
 */

#ifndef CVMFS_JSON_DOCUMENT_WRITE_H_
#define CVMFS_JSON_DOCUMENT_WRITE_H_

#include <cstdio>
#include <string>
#include <vector>

#include "util/exception.h"
#include "util/string.h"

#ifdef CVMFS_NAMESPACE_GUARD
namespace CVMFS_NAMESPACE_GUARD {
#endif

/**
 * This class is used for marshalling JSON objects to strings.
 *
 * When creating simple objects is sufficient to call the `Add()` methods to add
 * new key - values to the final JSON.
 *
 * When creating complex objects, (an object that contains another object) is
 * necessary to create first the nested object and then add it to the final
 * object with the `AddJsonObject`. This will take care of all the escaping.
{'fraction_non_alphanumeric': 0.07834101382488479, 'fraction_numerical': 0.0, 'mean_word_length': 4.791111111111111, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3486806', 'n_tokens_mistral': 413, 'n_tokens_neox': 406, 'n_words': 157}