json xml texts
This commit is contained in:
		
							parent
							
								
									f5a5ca6550
								
							
						
					
					
						commit
						c756058c5c
					
				| @ -487,9 +487,17 @@ tools: | ||||
|   json-to-xml: | ||||
|     title: JSON zu XML | ||||
|     description: JSON in XML konvertieren | ||||
|     input: Dein JSON-Inhalt | ||||
|     input-placeholder: Füge hier deinen JSON-Inhalt ein... | ||||
|     output: Konvertiertes XML | ||||
|     error: Bereitgestelltes JSON ist ungültig. | ||||
|   xml-to-json: | ||||
|     title: XML zu JSON | ||||
|     description: XML in JSON konvertieren | ||||
|     input: Dein XML-Inhalt | ||||
|     input-placeholder: Füge hier deinen XML-Inhalt ein... | ||||
|     output: Konvertiertes JSON | ||||
|     error: Bereitgestelltes XML ist ungültig. | ||||
|   email-normalizer: | ||||
|     title: E-Mail-Normalisierung | ||||
|     description: >- | ||||
|  | ||||
| @ -456,9 +456,17 @@ tools: | ||||
|   json-to-xml: | ||||
|     title: JSON to XML | ||||
|     description: Convert JSON to XML | ||||
|     input: Your JSON content | ||||
|     input-placeholder: Paste your JSON content here... | ||||
|     output: Converted XML | ||||
|     error: Provided JSON is not valid. | ||||
|   xml-to-json: | ||||
|     title: XML to JSON | ||||
|     description: Convert XML to JSON | ||||
|     input: Your XML content | ||||
|     input-placeholder: Paste your XML content here... | ||||
|     output: Converted JSON | ||||
|     error: Provided XML is not valid. | ||||
|   email-normalizer: | ||||
|     title: Email normalizer | ||||
|     description: >- | ||||
|  | ||||
| @ -4,6 +4,7 @@ import JSON5 from 'json5'; | ||||
| import { withDefaultOnError } from '@/utils/defaults'; | ||||
| import type { UseValidationRule } from '@/composable/validation'; | ||||
| 
 | ||||
| const { t } = useI18n(); | ||||
| const defaultValue = '{"a":{"_attributes":{"x":"1.234","y":"It\'s"}}}'; | ||||
| function transformer(value: string) { | ||||
|   return withDefaultOnError(() => { | ||||
| @ -14,17 +15,17 @@ function transformer(value: string) { | ||||
| const rules: UseValidationRule<string>[] = [ | ||||
|   { | ||||
|     validator: (v: string) => v === '' || JSON5.parse(v), | ||||
|     message: 'Provided JSON is not valid.', | ||||
|     message: t('tools.json-to-xml.error'), | ||||
|   }, | ||||
| ]; | ||||
| </script> | ||||
| 
 | ||||
| <template> | ||||
|   <format-transformer | ||||
|     input-label="Your JSON content" | ||||
|     :input-label="t('tools.json-to-xml.input')" | ||||
|     :input-default="defaultValue" | ||||
|     input-placeholder="Paste your JSON content here..." | ||||
|     output-label="Converted XML" | ||||
|     :input-placeholder="t('tools.json-to-xml.input-placeholder')" | ||||
|     :output-label="t('tools.json-to-xml.output')" | ||||
|     output-language="xml" | ||||
|     :transformer="transformer" | ||||
|     :input-validation-rules="rules" | ||||
|  | ||||
| @ -4,6 +4,7 @@ import { isValidXML } from '../xml-formatter/xml-formatter.service'; | ||||
| import { withDefaultOnError } from '@/utils/defaults'; | ||||
| import type { UseValidationRule } from '@/composable/validation'; | ||||
| 
 | ||||
| const { t } = useI18n(); | ||||
| const defaultValue = '<a x="1.234" y="It\'s"/>'; | ||||
| function transformer(value: string) { | ||||
|   return withDefaultOnError(() => { | ||||
| @ -14,17 +15,17 @@ function transformer(value: string) { | ||||
| const rules: UseValidationRule<string>[] = [ | ||||
|   { | ||||
|     validator: isValidXML, | ||||
|     message: 'Provided XML is not valid.', | ||||
|     message: t('tools.xml-to-json.error'), | ||||
|   }, | ||||
| ]; | ||||
| </script> | ||||
| 
 | ||||
| <template> | ||||
|   <format-transformer | ||||
|     input-label="Your XML content" | ||||
|     :input-label="t('tools.xml-to-json.input')" | ||||
|     :input-default="defaultValue" | ||||
|     input-placeholder="Paste your XML content here..." | ||||
|     output-label="Converted JSON" | ||||
|     :input-placeholder="t('tools.xml-to-json.input-placeholder')" | ||||
|     :output-label="t('tools.xml-to-json.output')" | ||||
|     output-language="json" | ||||
|     :transformer="transformer" | ||||
|     :input-validation-rules="rules" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user