Pull Element and FieldElement out into functions

This makes them easier to reuse in the future and a little less coupled.

Change-Id: Ib70319ed91381e0b30f4e87fbfe6d262c1c0f179
diff --git a/aos/BUILD b/aos/BUILD
index 83b8a18..c73336e 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -417,10 +417,20 @@
 )
 
 cc_library(
+    name = "flatbuffer_utils",
+    srcs = ["flatbuffer_utils.cc"],
+    hdrs = ["flatbuffer_utils.h"],
+    deps = [
+        "@com_github_google_flatbuffers//:flatbuffers",
+    ],
+)
+
+cc_library(
     name = "json_to_flatbuffer",
     srcs = ["json_to_flatbuffer.cc"],
     hdrs = ["json_to_flatbuffer.h"],
     deps = [
+        ":flatbuffer_utils",
         "//aos/logging",
         "@com_github_google_flatbuffers//:flatbuffers",
     ],