Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
Go to the documentation of this file.
344 GRASSROOTS_UTIL_API LinkedList *
GetTabularHeaders (
char **data_ss,
const char column_delimiter,
const char row_delimiter, json_type (*get_type_fn) (
const char *name_s,
const void *
const data_p),
const void *
const type_data_p);
char ** GetStringArrayFromJSON(const json_t *const array_p, bool add_terminating_null_flag)
Created an array of c-style string of StringListNodes from a json array.
void FreeFieldNode(ListItem *node_p)
Free a FieldNode.
bool DeepCopyValidJSON(const json_t *src_p, json_t **dest_pp)
Make a deep copy of a source JSON fragment to another.
json_t * ConvertTabularDataToJSON(char *data_s, const char column_delimiter, const char row_delimiter, LinkedList *headers_p)
Convert a string of tabular data into a JSON array using the given column headings.
bool SetNonTrivialString(json_t *value_p, const char *key_s, const char *value_s, const bool null_flag)
MEM_FLAG
An enum specifying the particular status of a piece of dynamically allocated memory for a particular ...
Definition: memory_allocations.h:38
LinkedList * GetTabularHeaders(char **data_ss, const char column_delimiter, const char row_delimiter, json_type(*get_type_fn)(const char *name_s, const void *const data_p), const void *const type_data_p)
Get the column headers from the first row of a tabular data variable.
void FreeJsonNode(ListItem *node_p)
Free a JsonNode.
json_t * ConvertRowToJSON(char *row_s, LinkedList *headers_p, const char delimiter)
Create a JSON object from a delimited string of data.
int PrintJSONToLog(const uint32 level, const char *filename_s, const int line_number, const json_t *json_p, const char *message_s,...)
Print a json_t object to the logging stream.
bool SetJSONStringOrNull(json_t *json_p, const char *const key_s, const char *const value_s, const bool null_flag)
bool AddStringListToJSON(json_t *parent_p, LinkedList *values_p, const char *const child_key_s)
Create and add a LinkedList of StringListNodes to a json object.
bool IsJSONEmpty(const json_t *json_p)
Is a json_t NULL or empty?
bool SetNonTrivialUnsignedInt(json_t *json_p, const char *key_s, const uint32 *value_p, const bool null_flag)
json_t * SplitJSON(json_t *src_p, uint8 percentage_to_move)
bool AddValidJSONString(json_t *parent_p, const char *const key_s, const char *const value_s)
Add a string key-value pair to a JSON object only if the value is not NULL.
bool SetIntegerFromJSON(const json_t *json_p, json_int_t *value_p)
Get the integer value of a JSON object.
int PrintJSON(FILE *out_f, const json_t *const json_p, const char *const prefix_s)
Print a json fragment to a FILE pointer.
bool AddOntologyContextTerm(json_t *root_p, const char *key_s, const char *term_s, const bool add_id_flag)
Add a "@context" section to a JSON fragment to define a class.
json_t * LoadJSONFile(const char *const filename_s)
Load a JSON file.
bool SetNonTrivialDouble(json_t *json_p, const char *key_s, const double64 *value_p, const bool null_fla)
JsonNode * AllocateJsonNode(json_t *json_p)
Allocate a JsonNode that points to the given json object.
StringListNode fn_base_node
The base node.
Definition: json_util.h:74
bool GetJSONStringAsDouble(const json_t *json_p, const char *const key_s, double *answer_p)
The keys for the Grassroots Schema.
FieldNode * AllocateFieldNode(const char *name_s, const MEM_FLAG mf, json_type field_type)
Allocate a FieldNode that points to the given json object.
char * GetCopiedJSONString(const json_t *json_p, const char *const key_s)
Get the newly-allocated value for a given key in a json_t object.
bool SetLongFromJSON(const json_t *json_p, int64 *value_p)
Get the long value of a JSON object.
A datatype for storing a json_t on a LinkedList.
Definition: json_util.h:43
ListItem jn_node
The base List node.
Definition: json_util.h:48
bool GetJSONStringAsInteger(const json_t *json_p, const char *const key_s, int *answer_p)
json_t * GetCompoundJSONObject(const json_t *input_p, const char *const compound_s)
Get a descendant JSON object from another using a given selector.
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
bool CopyJSONKeyIntegerValuePair(const json_t *src_p, json_t *dest_p, const char *const key_s, bool optional_flag)
Make a copy of given key-value pair from one JSON object to another.
bool SetJSONInteger(json_t *json_p, const char *const key_s, const json_int_t value)
#define GRASSROOTS_UTIL_LOCAL
Definition: grassroots_util_library.h:48
bool GetJSONLong(const json_t *json_p, const char *const key_s, long *value_p)
Get the long value for a given key in a json_t object.
bool GetJSONBoolean(const json_t *json_p, const char *const key_s, bool *value_p)
Get the boolean value for a given key in a json_t object.
bool SetBooleanFromJSON(const json_t *json_p, bool *value_p)
Set the boolean value of a JSON object.
const char * GetJSONString(const json_t *json_p, const char *const key_s)
Get the value for a given key in a json_t object.
bool GetJSONUnsignedInteger(const json_t *json_p, const char *const key_s, uint32 *value_p)
bool GetJSONReal(const json_t *json_p, const char *const key_s, double *value_p)
Get the double value for a given key in a json_t object.
LinkedList * GetStringListFromJSON(const json_t *const array_p)
Created a LinkedList of StringListNodes from a json array.
json_t * ConvertTabularDataWithHeadersToJSON(char *data_s, const char column_delimiter, const char row_delimiter, json_type(*get_type_fn)(const char *name_s, const void *const data_p), const void *const type_data_p)
Convert a string of tabular data into a JSON array.
A ListNode for LinkedLists that also stores a string value.
Definition: string_linked_list.h:49
bool AddStringArrayToJSON(json_t *parent_p, const char **const values_ss, const char *const child_key_s)
Create and add an array of c-style strings to a json object.
int PrintJSONToErrors(const uint32 level, const char *filename_s, const int line_number, const json_t *json_p, const char *message_s,...)
Print a json_t object to the error stream.
bool GetJSONInteger(const json_t *json_p, const char *const key_s, json_int_t *value_p)
Get the integer value for a given key in a json_t object.
json_t * ConvertStringArrayToJSON(char **values_ss, const size_t num_values)
json_t * jn_json_p
Pointer to the json object.
Definition: json_util.h:51
bool SetStringFromJSON(const json_t *json_p, char **value_ss)
Get the string value of a JSON object.
void PrintJSONRefCounts(const uint32 log_level, const char *const filename_s, const int line_number, const json_t *const value_p, const char *initial_s)
Print the reference counts for all of the entries in a json_t object to the logging stream.
bool SetJSONBoolean(json_t *json_p, const char *const key_s, const bool value)
bool CopyJSONKeyStringValuePair(const json_t *src_p, json_t *dest_p, const char *const key_s, bool optional_flag)
Make a copy of given key-value pair from one JSON object to another.
json_type fn_type
This defines the type of the data.
Definition: json_util.h:77
bool SetRealFromJSON(const json_t *json_p, double *value_p)
Get the real value of a JSON object.
bool GetRealValueFromJSONString(const json_t *json_p, double64 *answer_p)
bool SetJSONReal(json_t *json_p, const char *const key_s, const double value)
A datatype for storing a value as a string along with the datatype to convert it to.
Definition: json_util.h:71
A doubly-linked list of strings.
bool SetJSONString(json_t *json_p, const char *const key_s, const char *const value_s)
bool SetJSONNull(json_t *json_p, const char *const key_s)
Add a child key to a JSON object where the value is null.
#define GRASSROOTS_UTIL_API
Definition: grassroots_util_library.h:47
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43