Add flatbuffer to json using reflection schema
Change-Id: I6f32c0403a74ec951e6c730c4006ede3bc91099c
diff --git a/aos/json_to_flatbuffer.h b/aos/json_to_flatbuffer.h
index 94b982a..f90a602 100644
--- a/aos/json_to_flatbuffer.h
+++ b/aos/json_to_flatbuffer.h
@@ -7,13 +7,13 @@
#include "aos/flatbuffers.h"
#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/reflection.h"
namespace aos {
// Parses the flatbuffer into the vector, or returns an empty vector.
flatbuffers::DetachedBuffer JsonToFlatbuffer(
- const std::string_view data,
- const flatbuffers::TypeTable *typetable);
+ const std::string_view data, const flatbuffers::TypeTable *typetable);
// Converts a flatbuffer into a Json string.
// multi_line controls if the Json is written out on multiple lines or one.
@@ -53,6 +53,9 @@
Flatbuffer<T>::MiniReflectTypeTable(), multi_line);
}
+std::string FlatbufferToJson(const reflection::Schema *const schema,
+ const uint8_t *const data);
+
} // namespace aos
#endif // AOS_JSON_TO_FLATBUFFER_H_