10int TestJson(
int argc,
char* argv[])
12 static const char jsonData[] =
"{\r\n \"value\": \"test\"\r\n}\r\n";
15 WINPR_JSON* json =
nullptr;
21 path = GetCombinedPath(TEST_BINARY_PATH,
"TestJson-crlf.json");
25 fp = winpr_fopen(path,
"wb");
29 if (fwrite(jsonData,
sizeof(
char),
sizeof(jsonData) - 1, fp) !=
sizeof(jsonData) - 1)
45 if (!str || (strcmp(str,
"test") != 0))
55 (void)winpr_DeleteFile(path);
WINPR_API WINPR_JSON * WINPR_JSON_ParseFromFile(const char *filename)
Parse a JSON string read from a file filename.
WINPR_ATTR_NODISCARD WINPR_API WINPR_JSON * WINPR_JSON_GetObjectItem(const WINPR_JSON *object, const char *string)
Return a pointer to an JSON object item.
WINPR_ATTR_NODISCARD WINPR_API BOOL WINPR_JSON_IsString(const WINPR_JSON *item)
Check if JSON item is of type String.
WINPR_API void WINPR_JSON_Delete(WINPR_JSON *item)
Delete a WinPR JSON wrapper object.
WINPR_ATTR_NODISCARD WINPR_API const char * WINPR_JSON_GetStringValue(WINPR_JSON *item)
Return the String value of a JSON item.