code: def test_io_tensor_json_recods_mode():
      """Test case for tfio.IOTensor.from_json."""
      x_test = [[1.1, 2], [2.1, 3]]
      y_test = [[2.2, 3], [1.2, 3]]
      feature_filename = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_json",
          "feature.json",
      )
      feature_filename = "file://" + feature_filename
      label_filename = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_json",
          "label.json",
      )
      label_filename = "file://" + label_filename
  
      features = tfio.IOTensor.from_json(
          feature_filename, mode="records"
      )
      assert features("floatfeature").dtype == tf.float64
      assert features("integerfeature").dtype == tf.int64
  
      labels = tfio.IOTensor.from_json(label_filename, mode="records")
      assert labels("floatlabel").dtype == tf.float64
      assert labels("integerlabel").dtype == tf.int64
  
      float_feature = features("floatfeature")
      integer_feature = features("integerfeature")
      float_label = labels("floatlabel")
      integer_label = labels("integerlabel")
  
      for i in range(2):
          v_x = x_test[i]
          v_y = y_test[i]
          assert v_x[0] == float_feature[i].numpy()
          assert v_x[1] == integer_feature[i].numpy()
          assert v_y[0] == float_label[i].numpy()
          assert v_y[1] == integer_label[i].numpy()
  
      feature_dataset = tfio.IODataset.from_json(
          feature_filename, mode="records"
      )
      label_dataset = tfio.IODataset.from_json(
          label_filename, mode="records"
      )
  
      dataset = tf.data.Dataset.zip((feature_dataset, label_dataset))
  
      i = 0
      for j_x, j_y in dataset:
          v_x = x_test[i]
          v_y = y_test[i]
          for index, x in enumerate(j_x):
              assert v_x[index] == x.numpy()
          for index, y in enumerate(j_y):
              assert v_y[index] == y.numpy()
          i += 1
      assert i == len(y_test)
  
      # single column
      floatfeature = tfio.IODataset.from_json(
          feature_filename, columns=["floatfeature"], mode="records"
      )
      i = 0
      for v in floatfeature:
          assert x_test[i][0] == v.numpy()
          i += 1
      assert i == len(x_test)
  
file_path: io/tests/test_json.py
imports: import os
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 1 for calling a global function with example usage: test_io_tensor_json_recods_mode() without return types