- /* Create JSON object for transaction on this row. */
- row_json = json_object_create();
- if (old_json) {
- json_object_put(row_json, "old", old_json);
+ json = NULL;
+ SHASH_FOR_EACH (node, &monitor->tables) {
+ struct ovsdb_jsonrpc_monitor_table *mt = node->data;
+ struct ovsdb_jsonrpc_monitor_row *row, *next;
+ struct json *table_json = NULL;
+
+ HMAP_FOR_EACH_SAFE (row, next, hmap_node, &mt->changes) {
+ struct json *row_json;
+
+ row_json = ovsdb_jsonrpc_monitor_compose_row_update(
+ mt, row, initial, changed);
+ if (row_json) {
+ char uuid[UUID_LEN + 1];
+
+ /* Create JSON object for transaction overall. */
+ if (!json) {
+ json = json_object_create();
+ }
+
+ /* Create JSON object for transaction on this table. */
+ if (!table_json) {
+ table_json = json_object_create();
+ json_object_put(json, mt->table->schema->name, table_json);
+ }
+
+ /* Add JSON row to JSON table. */
+ snprintf(uuid, sizeof uuid, UUID_FMT, UUID_ARGS(&row->uuid));
+ json_object_put(table_json, uuid, row_json);
+ }
+
+ hmap_remove(&mt->changes, &row->hmap_node);
+ ovsdb_jsonrpc_monitor_row_destroy(mt, row);
+ }