Skip to content

Commit

Permalink
fix: json to java typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
sharevb committed Nov 20, 2024
1 parent 0c2a2e9 commit 7720721
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/tools/json-to-java/json-to-java.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ export function convert(className: string, data: string | null) {
if (data === null) {
return '';
}
if (typeof data === 'string') {
data = JSON.parse(data);
}
const obj = JSON.parse(data);
if (className === '') {
className = 'Result';
}
const keys = Object.keys(data);
const keys = Object.keys(obj);
const objects: { [key: string]: any } = {};
className = capitalizeFirstLetter(className);
let result = `public class ${className} {\n`;
for (const i in keys) {
const key = keys[i];
const value = data[key];
const value = obj[key];
let type = typeof value as string;
if (Array.isArray(value)) {
const typeName = capitalizeFirstLetter(fixListClass(key));
Expand Down

0 comments on commit 7720721

Please sign in to comment.