json.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. @file json.h
  3. @brief handles very basic JSON with a minimal footprint on the system
  4. This code is a lightly modified version of cJSON 1.4.7. cJSON is licensed under the MIT license:
  5. Copyright (c) 2009 Dave Gamble
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  10. of the Software, and to permit persons to whom the Software is furnished to do
  11. so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in all
  13. copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  15. INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  16. PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  17. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
  18. OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  19. OTHER DEALINGS IN THE SOFTWARE.
  20. @see https://github.com/DaveGamble/cJSON
  21. */
  22. #ifndef JSON_H_INCLUDED
  23. #define JSON_H_INCLUDED
  24. #include <stdbool.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /**
  29. * @brief Render the cstring provided to a JSON escaped version that can be printed.
  30. * @param input the input buffer to be escaped.
  31. * @param output_buffer the output buffer to write to. You must ensure it is big enough to contain the final string.
  32. * @see cJSON equivlaent static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer)
  33. */
  34. bool json_print_string(const unsigned char *input, unsigned char *output_buffer);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif /* JSON_H_INCLUDED */