From 5e2d56a6de6661c138558347eadf6cc39ce38eff Mon Sep 17 00:00:00 2001 From: Rodrigo Nader Date: Sat, 30 Mar 2024 19:08:00 -0300 Subject: [PATCH] Delete JSONInput component --- .../langflow/components/inputs/JSONInput.py | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 src/backend/base/langflow/components/inputs/JSONInput.py diff --git a/src/backend/base/langflow/components/inputs/JSONInput.py b/src/backend/base/langflow/components/inputs/JSONInput.py deleted file mode 100644 index 752f41aa1..000000000 --- a/src/backend/base/langflow/components/inputs/JSONInput.py +++ /dev/null @@ -1,30 +0,0 @@ -import ast -import json - -from langflow import CustomComponent -from langflow.schema import Record - - -class JSONInputComponent(CustomComponent): - display_name = "JSON Input" - description = "Load a JSON object as input." - - def build_config(self): - return { - "json_str": { - "display_name": "JSON String", - "multiline": True, - "info": "The JSON string to load.", - } - } - - def build(self, json_str: str) -> Record: - try: - data = json.loads(json_str) - except json.JSONDecodeError: - try: - data = ast.literal_eval(json_str) - except (SyntaxError, ValueError): - raise ValueError("Invalid JSON string.") - record = Record(data=data) - return record