Project import generated by Copybara.
GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/node_modules/mdl-ext/src/utils/json-utils.js b/node_modules/mdl-ext/src/utils/json-utils.js
new file mode 100644
index 0000000..c6f6c77
--- /dev/null
+++ b/node_modules/mdl-ext/src/utils/json-utils.js
@@ -0,0 +1,18 @@
+'use strict';
+
+/**
+ * Converts a JSON string to object
+ * @param jsonString
+ * @param source
+ */
+const jsonStringToObject = (jsonString, source = {} ) => {
+ const s = jsonString.replace(/'/g, '"');
+ try {
+ return Object.assign(source, JSON.parse(s));
+ }
+ catch (e) {
+ throw new Error(`Failed to parse json string: ${s}. Error: ${e.message}`);
+ }
+};
+
+export { jsonStringToObject };