Merge f1185824a3 into 318fb6efb9
				
					
				
			This commit is contained in:
		
						commit
						700ee59f54
					
				
							
								
								
									
										29
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										29
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -90,17 +90,28 @@ declare module '@vue/runtime-core' { | ||||
|     HttpStatusCodes: typeof import('./src/tools/http-status-codes/http-status-codes.vue')['default'] | ||||
|     IbanValidatorAndParser: typeof import('./src/tools/iban-validator-and-parser/iban-validator-and-parser.vue')['default'] | ||||
|     'IconMdi:brushVariant': typeof import('~icons/mdi/brush-variant')['default'] | ||||
|     'IconMdi:contentCopy': typeof import('~icons/mdi/content-copy')['default'] | ||||
|     'IconMdi:kettleSteamOutline': typeof import('~icons/mdi/kettle-steam-outline')['default'] | ||||
|     IconMdiArrowDown: typeof import('~icons/mdi/arrow-down')['default'] | ||||
|     IconMdiArrowRightBottom: typeof import('~icons/mdi/arrow-right-bottom')['default'] | ||||
|     IconMdiCamera: typeof import('~icons/mdi/camera')['default'] | ||||
|     IconMdiChevronDown: typeof import('~icons/mdi/chevron-down')['default'] | ||||
|     IconMdiChevronRight: typeof import('~icons/mdi/chevron-right')['default'] | ||||
|     IconMdiClose: typeof import('~icons/mdi/close')['default'] | ||||
|     IconMdiContentCopy: typeof import('~icons/mdi/content-copy')['default'] | ||||
|     IconMdiDeleteOutline: typeof import('~icons/mdi/delete-outline')['default'] | ||||
|     IconMdiDownload: typeof import('~icons/mdi/download')['default'] | ||||
|     IconMdiEye: typeof import('~icons/mdi/eye')['default'] | ||||
|     IconMdiEyeOff: typeof import('~icons/mdi/eye-off')['default'] | ||||
|     IconMdiHeart: typeof import('~icons/mdi/heart')['default'] | ||||
|     IconMdiPause: typeof import('~icons/mdi/pause')['default'] | ||||
|     IconMdiPlay: typeof import('~icons/mdi/play')['default'] | ||||
|     IconMdiRecord: typeof import('~icons/mdi/record')['default'] | ||||
|     IconMdiRefresh: typeof import('~icons/mdi/refresh')['default'] | ||||
|     IconMdiSearch: typeof import('~icons/mdi/search')['default'] | ||||
|     IconMdiTranslate: typeof import('~icons/mdi/translate')['default'] | ||||
|     IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default'] | ||||
|     IconMdiVideo: typeof import('~icons/mdi/video')['default'] | ||||
|     InputCopyable: typeof import('./src/components/InputCopyable.vue')['default'] | ||||
|     IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default'] | ||||
|     Ipv4AddressConverter: typeof import('./src/tools/ipv4-address-converter/ipv4-address-converter.vue')['default'] | ||||
| @ -110,6 +121,7 @@ declare module '@vue/runtime-core' { | ||||
|     JsonDiff: typeof import('./src/tools/json-diff/json-diff.vue')['default'] | ||||
|     JsonMinify: typeof import('./src/tools/json-minify/json-minify.vue')['default'] | ||||
|     JsonToCsv: typeof import('./src/tools/json-to-csv/json-to-csv.vue')['default'] | ||||
|     JsonToObject: typeof import('./src/tools/json-to-object/json-to-object.vue')['default'] | ||||
|     JsonToToml: typeof import('./src/tools/json-to-toml/json-to-toml.vue')['default'] | ||||
|     JsonToXml: typeof import('./src/tools/json-to-xml/json-to-xml.vue')['default'] | ||||
|     JsonToYaml: typeof import('./src/tools/json-to-yaml-converter/json-to-yaml.vue')['default'] | ||||
| @ -128,23 +140,40 @@ declare module '@vue/runtime-core' { | ||||
|     MenuLayout: typeof import('./src/components/MenuLayout.vue')['default'] | ||||
|     MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default'] | ||||
|     MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default'] | ||||
|     NAlert: typeof import('naive-ui')['NAlert'] | ||||
|     NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default'] | ||||
|     NCheckbox: typeof import('naive-ui')['NCheckbox'] | ||||
|     NCode: typeof import('naive-ui')['NCode'] | ||||
|     NCollapseTransition: typeof import('naive-ui')['NCollapseTransition'] | ||||
|     NColorPicker: typeof import('naive-ui')['NColorPicker'] | ||||
|     NConfigProvider: typeof import('naive-ui')['NConfigProvider'] | ||||
|     NDatePicker: typeof import('naive-ui')['NDatePicker'] | ||||
|     NDivider: typeof import('naive-ui')['NDivider'] | ||||
|     NDynamicInput: typeof import('naive-ui')['NDynamicInput'] | ||||
|     NEllipsis: typeof import('naive-ui')['NEllipsis'] | ||||
|     NForm: typeof import('naive-ui')['NForm'] | ||||
|     NFormItem: typeof import('naive-ui')['NFormItem'] | ||||
|     NGi: typeof import('naive-ui')['NGi'] | ||||
|     NGrid: typeof import('naive-ui')['NGrid'] | ||||
|     NH1: typeof import('naive-ui')['NH1'] | ||||
|     NH2: typeof import('naive-ui')['NH2'] | ||||
|     NH3: typeof import('naive-ui')['NH3'] | ||||
|     NIcon: typeof import('naive-ui')['NIcon'] | ||||
|     NImage: typeof import('naive-ui')['NImage'] | ||||
|     NInputGroup: typeof import('naive-ui')['NInputGroup'] | ||||
|     NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel'] | ||||
|     NInputNumber: typeof import('naive-ui')['NInputNumber'] | ||||
|     NLayout: typeof import('naive-ui')['NLayout'] | ||||
|     NLayoutSider: typeof import('naive-ui')['NLayoutSider'] | ||||
|     NMenu: typeof import('naive-ui')['NMenu'] | ||||
|     NProgress: typeof import('naive-ui')['NProgress'] | ||||
|     NScrollbar: typeof import('naive-ui')['NScrollbar'] | ||||
|     NSlider: typeof import('naive-ui')['NSlider'] | ||||
|     NSpin: typeof import('naive-ui')['NSpin'] | ||||
|     NStatistic: typeof import('naive-ui')['NStatistic'] | ||||
|     NSwitch: typeof import('naive-ui')['NSwitch'] | ||||
|     NTable: typeof import('naive-ui')['NTable'] | ||||
|     NTag: typeof import('naive-ui')['NTag'] | ||||
|     NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default'] | ||||
|     OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default'] | ||||
|     PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default'] | ||||
|  | ||||
| @ -391,3 +391,6 @@ tools: | ||||
|   text-to-binary: | ||||
|     title: Text to ASCII binary | ||||
|     description: Convert text to its ASCII binary representation and vice-versa. | ||||
|   json-to-object: | ||||
|     title: JSON to object | ||||
|     description: Parse and convert JSON to object. | ||||
|  | ||||
| @ -83,6 +83,7 @@ | ||||
|     "plausible-tracker": "^0.3.8", | ||||
|     "qrcode": "^1.5.1", | ||||
|     "sql-formatter": "^13.0.0", | ||||
|     "stringify-object": "^5.0.0", | ||||
|     "ua-parser-js": "^1.0.35", | ||||
|     "ulid": "^2.3.0", | ||||
|     "unicode-emoji-json": "^0.4.0", | ||||
| @ -113,6 +114,7 @@ | ||||
|     "@types/node": "^18.15.11", | ||||
|     "@types/node-forge": "^1.3.2", | ||||
|     "@types/qrcode": "^1.5.0", | ||||
|     "@types/stringify-object": "^4.0.5", | ||||
|     "@types/ua-parser-js": "^0.7.36", | ||||
|     "@types/uuid": "^9.0.0", | ||||
|     "@unocss/eslint-config": "^0.57.0", | ||||
|  | ||||
							
								
								
									
										49
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										49
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							| @ -149,6 +149,9 @@ dependencies: | ||||
|   sql-formatter: | ||||
|     specifier: ^13.0.0 | ||||
|     version: 13.0.0 | ||||
|   stringify-object: | ||||
|     specifier: ^5.0.0 | ||||
|     version: 5.0.0 | ||||
|   ua-parser-js: | ||||
|     specifier: ^1.0.35 | ||||
|     version: 1.0.35 | ||||
| @ -235,6 +238,9 @@ devDependencies: | ||||
|   '@types/qrcode': | ||||
|     specifier: ^1.5.0 | ||||
|     version: 1.5.0 | ||||
|   '@types/stringify-object': | ||||
|     specifier: ^4.0.5 | ||||
|     version: 4.0.5 | ||||
|   '@types/ua-parser-js': | ||||
|     specifier: ^0.7.36 | ||||
|     version: 0.7.36 | ||||
| @ -3048,6 +3054,10 @@ packages: | ||||
|     resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} | ||||
|     dev: true | ||||
| 
 | ||||
|   /@types/stringify-object@4.0.5: | ||||
|     resolution: {integrity: sha512-TzX5V+njkbJ8iJ0mrj+Vqveep/1JBH4SSA3J2wYrE1eUrOhdsjTBCb0kao4EquSQ8KgPpqY4zSVP2vCPWKBElg==} | ||||
|     dev: true | ||||
| 
 | ||||
|   /@types/throttle-debounce@2.1.0: | ||||
|     resolution: {integrity: sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==} | ||||
|     dev: false | ||||
| @ -3360,7 +3370,7 @@ packages: | ||||
|     dependencies: | ||||
|       '@unhead/dom': 0.5.1 | ||||
|       '@unhead/schema': 0.5.1 | ||||
|       '@vueuse/shared': 10.11.1(vue@3.3.4) | ||||
|       '@vueuse/shared': 11.0.0(vue@3.3.4) | ||||
|       unhead: 0.5.1 | ||||
|       vue: 3.3.4 | ||||
|     transitivePeerDependencies: | ||||
| @ -3993,19 +4003,19 @@ packages: | ||||
|       - vue | ||||
|     dev: false | ||||
| 
 | ||||
|   /@vueuse/shared@10.11.1(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-LHpC8711VFZlDaYUXEBbFBCQ7GS3dVU9mjOhhMhXP6txTV4EhYQg/KGnQuvt/sPAtoUKq7VVUnL6mVtFoL42sA==} | ||||
|   /@vueuse/shared@10.3.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-kGqCTEuFPMK4+fNWy6dUOiYmxGcUbtznMwBZLC1PubidF4VZY05B+Oht7Jh7/6x4VOWGpvu3R37WHi81cKpiqg==} | ||||
|     dependencies: | ||||
|       vue-demi: 0.14.10(vue@3.3.4) | ||||
|       vue-demi: 0.14.5(vue@3.3.4) | ||||
|     transitivePeerDependencies: | ||||
|       - '@vue/composition-api' | ||||
|       - vue | ||||
|     dev: false | ||||
| 
 | ||||
|   /@vueuse/shared@10.3.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-kGqCTEuFPMK4+fNWy6dUOiYmxGcUbtznMwBZLC1PubidF4VZY05B+Oht7Jh7/6x4VOWGpvu3R37WHi81cKpiqg==} | ||||
|   /@vueuse/shared@11.0.0(vue@3.3.4): | ||||
|     resolution: {integrity: sha512-i4ZmOrIEjSsL94uAEt3hz88UCz93fMyP/fba9S+vypX90fKg3uYX9cThqvWc9aXxuTzR0UGhOKOTQd//Goh1nQ==} | ||||
|     dependencies: | ||||
|       vue-demi: 0.14.5(vue@3.3.4) | ||||
|       vue-demi: 0.14.10(vue@3.3.4) | ||||
|     transitivePeerDependencies: | ||||
|       - '@vue/composition-api' | ||||
|       - vue | ||||
| @ -5799,6 +5809,11 @@ packages: | ||||
|       hasown: 2.0.0 | ||||
|     dev: true | ||||
| 
 | ||||
|   /get-own-enumerable-keys@1.0.0: | ||||
|     resolution: {integrity: sha512-PKsK2FSrQCyxcGHsGrLDcK0lx+0Ke+6e8KFFozA9/fIQLhQzPaRvJFdcz7+Axg3jUH/Mq+NI4xa5u/UT2tQskA==} | ||||
|     engines: {node: '>=14.16'} | ||||
|     dev: false | ||||
| 
 | ||||
|   /get-own-enumerable-property-symbols@3.0.2: | ||||
|     resolution: {integrity: sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==} | ||||
|     dev: true | ||||
| @ -6351,6 +6366,11 @@ packages: | ||||
|     engines: {node: '>=0.10.0'} | ||||
|     dev: true | ||||
| 
 | ||||
|   /is-obj@3.0.0: | ||||
|     resolution: {integrity: sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ==} | ||||
|     engines: {node: '>=12'} | ||||
|     dev: false | ||||
| 
 | ||||
|   /is-path-inside@3.0.3: | ||||
|     resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} | ||||
|     engines: {node: '>=8'} | ||||
| @ -6385,6 +6405,11 @@ packages: | ||||
|     engines: {node: '>=0.10.0'} | ||||
|     dev: true | ||||
| 
 | ||||
|   /is-regexp@3.1.0: | ||||
|     resolution: {integrity: sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==} | ||||
|     engines: {node: '>=12'} | ||||
|     dev: false | ||||
| 
 | ||||
|   /is-shared-array-buffer@1.0.2: | ||||
|     resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} | ||||
|     dependencies: | ||||
| @ -8292,6 +8317,15 @@ packages: | ||||
|       is-regexp: 1.0.0 | ||||
|     dev: true | ||||
| 
 | ||||
|   /stringify-object@5.0.0: | ||||
|     resolution: {integrity: sha512-zaJYxz2FtcMb4f+g60KsRNFOpVMUyuJgA51Zi5Z1DOTC3S59+OQiVOzE9GZt0x72uBGWKsQIuBKeF9iusmKFsg==} | ||||
|     engines: {node: '>=14.16'} | ||||
|     dependencies: | ||||
|       get-own-enumerable-keys: 1.0.0 | ||||
|       is-obj: 3.0.0 | ||||
|       is-regexp: 3.1.0 | ||||
|     dev: false | ||||
| 
 | ||||
|   /strip-ansi@6.0.1: | ||||
|     resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} | ||||
|     engines: {node: '>=8'} | ||||
| @ -9465,7 +9499,6 @@ packages: | ||||
| 
 | ||||
|   /workbox-google-analytics@7.0.0: | ||||
|     resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==} | ||||
|     deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained | ||||
|     dependencies: | ||||
|       workbox-background-sync: 7.0.0 | ||||
|       workbox-core: 7.0.0 | ||||
|  | ||||
| @ -84,6 +84,7 @@ import { tool as uuidGenerator } from './uuid-generator'; | ||||
| import { tool as macAddressLookup } from './mac-address-lookup'; | ||||
| import { tool as xmlFormatter } from './xml-formatter'; | ||||
| import { tool as yamlViewer } from './yaml-viewer'; | ||||
| import { tool as jsonToObject } from './json-to-object'; | ||||
| 
 | ||||
| export const toolsByCategory: ToolCategory[] = [ | ||||
|   { | ||||
| @ -148,6 +149,7 @@ export const toolsByCategory: ToolCategory[] = [ | ||||
|       jsonViewer, | ||||
|       jsonMinify, | ||||
|       jsonToCsv, | ||||
|       jsonToObject, | ||||
|       sqlPrettify, | ||||
|       chmodCalculator, | ||||
|       dockerRunToDockerComposeConverter, | ||||
|  | ||||
							
								
								
									
										13
									
								
								src/tools/json-to-object/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/tools/json-to-object/index.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| import { Braces } from '@vicons/tabler'; | ||||
| import { defineTool } from '../tool'; | ||||
| import { translate } from '@/plugins/i18n.plugin'; | ||||
| 
 | ||||
| export const tool = defineTool({ | ||||
|   name: translate('tools.json-to-object.title'), | ||||
|   path: '/json-to-object', | ||||
|   description: translate('tools.json-to-object.description'), | ||||
|   keywords: ['json', 'parse', 'object', 'convert', 'transform'], | ||||
|   component: () => import('./json-to-object.vue'), | ||||
|   icon: Braces, | ||||
|   createdAt: new Date('2024-08-16'), | ||||
| }); | ||||
							
								
								
									
										32
									
								
								src/tools/json-to-object/json-to-object.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/tools/json-to-object/json-to-object.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| <script setup lang="ts"> | ||||
| import JSON5 from 'json5'; | ||||
| import stringifyObject from 'stringify-object'; | ||||
| import type { UseValidationRule } from '@/composable/validation'; | ||||
| import { isNotThrowing } from '@/utils/boolean'; | ||||
| import { withDefaultOnError } from '@/utils/defaults'; | ||||
| 
 | ||||
| function transformer(value: string) { | ||||
|   return withDefaultOnError(() => stringifyObject(JSON5.parse(value), { | ||||
|     indent: '  ', | ||||
|     singleQuotes: false, | ||||
|   }), ''); | ||||
| } | ||||
| 
 | ||||
| const rules: UseValidationRule<string>[] = [ | ||||
|   { | ||||
|     validator: (value: string) => value === '' || isNotThrowing(() => stringifyObject(JSON5.parse(value))), | ||||
|     message: 'Provided JSON is not valid.', | ||||
|   }, | ||||
| ]; | ||||
| </script> | ||||
| 
 | ||||
| <template> | ||||
|   <format-transformer | ||||
|     input-label="Your JSON" | ||||
|     input-placeholder="Paste your JSON here..." | ||||
|     output-label="Object from your JSON" | ||||
|     output-language="js" | ||||
|     :input-validation-rules="rules" | ||||
|     :transformer="transformer" | ||||
|   /> | ||||
| </template> | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user