javascript – Criar arquivos JSON relacionando arrays

Eu tenho dois arquivos json, um com id, estado e sigla e o outro com a id do estado e as cidades desse estado. Eu fiz a leitura desses arquivos e gravei o conteúdo em arrays, mas eu preciso criar um arquivo para cada estado com suas respectivas cidades, relacionando os ids. Até agora consegui criar os arquivos separados por estado no primeiro FOR, mas estou em dúvida de como colocar as cidades de cada um em seu conteúdo, só consegui mesmo criar os arquivos e a estrutura inicial do JSON:

var fs = require("fs");

let dataStates = fs.readFileSync("Estados.json", "utf8");

let states = JSON.parse(dataStates);
let sigla = states.map((state) => {
  const { ID, Sigla, Nome } = state;
  return {
    idstate: ID,
    sigla: Sigla,
    estadoNome: Nome,
  };
});
//console.log(sigla);

let dataCities = fs.readFileSync("Cidades.json", "utf8");

let cities = JSON.parse(dataCities);
let nome = cities.map((city) => {
  const { ID, Nome, Estado } = city;
  return {
    idcity: ID,
    cidadeNome: Nome,
    cidadeEstado: Estado,
  };
});
//console.log(nome);

const initialJson = {
  nextId: 1,
  cidades: (),
};

for(i = 0; i < sigla.length; i++){
  fs.writeFileSync(sigla(i).sigla + '.json', JSON.stringify(initialJson));

    for(l = 0; l < nome.length; l++){
      cidades = { id: nextId++, name: nome(l).cidadeNome };
      cidades.push(cidades);
      fs.writeFileSync(sigla(i).sigla + '.json', JSON.stringify(cidades));
}
}

AES encryption (in Java) of different JSON strings always produce same encrypted string as result. Why?

I have a program written in Java which takes JSON string as argument, encrypts it using AES then encodes it using Base64.
JSON string is like:

{"a": "b"} or {"a": "n"} or {"a": "k"} 

I.e related object would have one property a. Value part is randomly generated.

Program outputs for above JSON inputs looks like

UBNvKoRoGqk0PTQQL5K4Sw==
bKwlToSND3HkceDExEDXSw==
u/yKJq1FdoifBM+AnadC3A==

i.e. they are unique.

Same goes for {"a":"gn"} — random string with length 2. Same for 3 and so on.

But starting from 7 program produces the same encoded string for different inputs. I mean following JSON strings taken as input:

{"a": "pzfovvs"}
{"a": "bqwuvck"}

produces same string as output:

Dwg0Xjkot8UBfn+vbcCfOS4KluXB6RCFQ932Y9ABtIg=

Same goes for length 8 and 9. Starting from 10 results became unique again.

What is the explanation of this strange phenomenon?

(I can post code if needed.)

Ok, here is the code:

import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;

public class JWTEncryptor {

private static String algorithm = "AES";
private static Key key;
private static KeyGenerator keyGenerator;
private static Cipher cipher;

public static String encrypt(String jwt) throws Exception {
    if (key == null || cipher == null) {
        setUp();
    }
    cipher.init(Cipher.ENCRYPT_MODE, key);
    return Base64.getEncoder().encodeToString(cipher.doFinal(jwt.getBytes("UTF-8")));
}

private static void setUp() {
    try {
        cipher = Cipher.getInstance(algorithm);
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    if (keyGenerator != null) {
        key = keyGenerator.generateKey();
        return;
    }
    try {
        keyGenerator = KeyGenerator.getInstance(algorithm);
        key = keyGenerator.generateKey();
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    }
}

public static String decrypt(String encryptedJWT) throws Exception {
    cipher.init(Cipher.DECRYPT_MODE, key);
    return new 
   String(cipher.doFinal(Base64.getDecoder().decode(encryptedJWT)));
} 

}

json – Any ideas on how to use wget or some command line tool to crawl a website API?

I would like to use wget to do a quick and not so dirty API crawl.

The API returns a standardize json response:

 {
   "id": "Id-sdfjksfhksf",
   .... more stuff ....
   "_links": {
     "self" : {
        "href": "http://...uri-that-returns-this-object"
     },
     "owner": {
        "href": "http://...uri-that-returns-the-object-owner"
     },
 }

How can I get wget to crawl this API and follow the links in the _links section?

Any way to easily change a website template to a JSON file?

I am new to owning a website. I want to use the template ioboot. How can I easily change the contents so it is in all one json file to be able to upload it to AWS?

c# – How to properly format classes for JSON deserialization with JSON.net for Unity?

I am creating an inventory system and decided to keep a master list of all the items. The goal is to use JSON.net to parse the item list and populate the database of items. The JSON item list looks like:

{
    "Items":{
        "Ingredients":{

        },
        "Consumables": {
            "0" : {
                "ID" : "TP_Small",
                "Icon" : "Sprites/porridge.png",
                "Name" : "Small Tan Pill's Porridge",
                "Consumable" : true,
                "Cooldown": 0,
                "Duration": 3,
                "Effect Description" : "Restores 100 health.",
                "Description" : "A hearty drinkable meal from everyone's favorite hypercellulose gelatin timelord!!!",
                "SFX": "{eb4e9ad8-c6ac-414f-8d5e-c3d012ca6ae6}",
                "Bonuses" : {
                    "HP": 100,
                    "Stamina": 100,
                    "Tolerance": 20,
                    "Attack": 4
                    }

                }
        },
        "Concoctions":{

        },
        "Equipment": {

        },
        "Abilities" : {

        }   
    }
}

And this is the structure of the classes we are using to match the JSON:

(System.Serializable)
    public class Items
    {
        public List<ItemCategory> type { get; set; }
    }

    (System.Serializable)
    public class ItemCategory
    {
        public List<ItemBase> id { get; set; }
    }

    (System.Serializable)
    public class ItemBase
    {
        string ID { get; set; }
        string Icon { get; set; }
        string Name { get; set; }
        bool Consumable { get; set; }
        int Cooldown { get; set; }
        int Duration { get; set; }
        string EffectDescription { get; set; }
        string Description { get; set; }
        string SFX { get; set; }
        StatBonus Bonuses { get; set; }
    }

    (System.Serializable)
    public class StatBonus
    {
        int HP { get; set; }
        int Stamina { get; set; }
        int Tolerance { get; set; }
        int Attack { get; set; }
    }

However, when I use the debugger, it seems everything but the root class is null and the root class’s value is the “InventoryItems+items”, with InventoryItems being the name of the file.

How can I access an item by it’s number in the list? So items -> Consumables -> 0 and that element’s fields

The deserialization code:

TextAsset json = Resources.Load<TextAsset>("itemList");

        itemList = new Items();

        itemList = JsonConvert.DeserializeObject<Items>(json.text);

        Debug.Log(itemList);
        foreach(ItemCategory cat in itemList.type)
        {
            foreach(ItemBase b in cat.id)
            {
                Debug.Log(b.ToString());
            }
        }

json – AWS Big Data Architecture Improvement

I am working on a big data project to group and analyze large volumes of data scraped from the web in daily batches. The data is currently stored in S3 buckets and is tagged based off of a single specific property. References to files are grouped together and stored in DynamoDB based on the single property. The data is then loaded into ElasticSearch and is served to a web app.

The current architecture is:

Current Architecture

I am looking to change the architecture to allow JSON documents to be grouped based on more complex logic, rather than on a single property. For example, rather than merging into DynamoDB based on schema1.property1 == schema2.property2, I would like to group records by:
(schema1.property1 == schema2.property2) && (schema1.property1 > schema2.property3)

Potential Solution:

enter image description here
I am new to big data processing and am looking to build a solution that scales well. From my research, my initial thought is to run a daily Spark job on AWS EMR to load and join the JSON data based on the the necessary logic. While it seems feasible, I do not have experience in if Spark best suited for this or if I should use another framework/tool. Any advice would be greatly appreciated.

How to check and remove key-value pair from one json object present in other json object in same request. Code in java

From the first JSON object, if value against serviceRequestType and accountNumber key is found in another JSON object, then remove that object from request. So please help me to solve this issue. PFB JSON request for your reference. The solution must be using GSON object

    {
  "header": {
    "authToken": "ec90b3e00fa3dd1289699ca88ac26df27ced29e5c6a78ef8859e85566d99e6fd"
  },
  "body": {
    "serviceRequest": [
      {
        "header": {
          "productFamily": "tchfl",
          "serviceRequestType": "moratoriumEmiOptin"
        },
        "body": {
          "accountNumber": "TCFPL0485000010111379",
          "description": "kush.ashar@teknopoint.us",
          "gcid": "242524523"
        }
      },
      {
        "header": {
          "productFamily": "tchfl",
          "serviceRequestType": "moratoriumEmiOptin"
        },
        "body": {
          "accountNumber": "TCFPL0485000010111379",
          "description": "kush.ashar@teknopoint.us",
          "gcid": "242524523"
        }
      },
      {
        "header": {
          "productFamily": "tchfl",
          "serviceRequestType": "moratoriumEmiOptin"
        },
        "body": {
          "accountNumber": "TCFPL0485000010111379",
          "description": "kush.ashar@teknopoint.us",
          "gcid": "242524523"
        }
      }
    ]
  }
}

json – Filtrar dados de um array usando um campo de pesquisa com javascript

Estou fazendo um exercício e preciso fazer um campo de pesquisa no qual se for digitado pelo o usuário a letra A apareça todos os nomes que contenha a letra.
Nunca fiz um campo de pesquisa e estou precisando de ajuda para implementar ele no código abaixo.

Os dados dos usuários estão sendo salvos em allPeoples().

É possível usar o filter()? Se tiverem alguma dica de como ou o que usar.

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <title>Usuários</title>

       <!-- Compiled and minified CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="./css/style.css">
    <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>


</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col s12 center-container">
                <h1>Pesquisa de Usuários</h1>
            </div>
        </div>
        <div class="row center-container">
            <div class="col s12">
                <input class="input-field col s10" type="text" name="search" id="inputDataSearch" placeholder="Digite um nome">
                <input class="waves-effect waves-light btn" type="button" id="btnSearch" value="buscar">
            </div>
        </div>
        <div class="row center-container">
            <div class="col s6 box" style="margin-right: 5px" id="resultSearch">
                tsdc
            </div>
            <div class="col s6 box" id="resultSum">
                as
            </div>
        </div>
    </div>
    <!-- Compiled and minified JavaScript -->
    <script src="https://pt.stackoverflow.com/./js/script.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>

let allSexM = 0
let allSexF = 0

let somAges = 0
let middleAges = 0

let countPeople = 0
let i = 0

let allPeople = ()
let resultPeople = ()

let resultSearch = null
let resultSum = null
let inputDataSearch = null

let btnSearch


let url = 'https://randomuser.me/api/?seed=javascript&results=100&nat=BR&noinfo'

window.addEventListener('load', () => {

    resultSearch = document.querySelector('#resultSearch')
    resultSum = document.querySelector('#resultSum')
    inputDataSearch = document.querySelector('#inputDataSearch')
    btnSearch = document.querySelector('#btnSearch')

    fetchPeoples()
    //searchData()


    //console.log(inputDataSearch)
    //initSearch(inputDataSearch)

})

async function fetchPeoples() {

    const res = await fetch(url)
    const json = await res.json()

    allPeople = json.results.map(people => {

        const { name, age, sex, avatar} = people

/*      const nameFirst = {



        } */

        return {

            name: people.name,
            age: people.dob.age,
            sex: people.gender,
            avatar: people.picture.thumbnail

        }

        name

    })

    render()

    console.log()
}

function render() {

    renderSumary()
    renderListPeoples()

}

function renderSumary() {

    let allDataHTML = '<div>'

    allPeople.forEach(data => {

        const {name, age, sex, avatar} = data

        const dataListHTML = `
            <div class="list-data">
                <div>
                    <span>Sexo masculino:</span>
                    <span>Sexo feminino:</span>
                    <span>Soma das idades:</span>
                    <span>Média das idades:</span>
                </div>
            </div>
        `

        allDataHTML += dataListHTML
    })

    allDataHTML += '</div>'

    resultSum.innerHTML = allDataHTML

}

function renderListPeoples() {

    let peopleHTML = '<div>'

    allPeople.forEach(people => {

        const { name, age, sex, avatar} = people

        const peopleListHTML = `
            <div class="list-peoples">
                <div>
                    <span><img src="https://pt.stackoverflow.com/${avatar}">${name.first} ${name.last}, ${age} anos</span>
                </div>
            </div>

        `

        peopleHTML += peopleListHTML

    })

    peopleHTML += '</div>'

    resultSearch.innerHTML = peopleHTML

}

function searchData() {

    const inputValueData = document.querySelector('#inputDataSearch').value.toLowerCase()

    function keyEnterSearch() {

        inputDataSearch.addEventListener('keyup', event => {

            for (i = 0; i < allPeople.name.length; i++) {

                var encontrou = false;

            }

        })

    }

}

/*function initSearch(value) {

    const peopleSeach = allPeople.results.filter(people => {

        const nameFirst = people.results.name.first
        const nameLast = people.results.name.last

        if(nameFirst == '') {}

            return

    })

    btnSearch.addEventListener('click', event => {



    })

}*/

Java: Error deserialising an aggregate object from JSON (HAS-A relationship)

I am getting a Can not set com.google.api.services.androidmanagement.v1.model.HardwareInfo field com.google.api.services.androidmanagement.v1.model.Device.hardwareInfo to java.util.LinkedHashMap error when I am converting a Google API Services Device object to JSON (using Jackson 2.10.0) and reading back from it in a test. The Device object consists of objects of HardwareInfo, MemoryInfo objects that seems to be failing since the ObjectMapper is reading them as LinkedHashMap instead of the actual types. I tried searching on StackOverflow and went through a load of articles but none of them seem to be addressing this JsonMappingException.

What am I doing wrong and how do I fix this? I tried using Mixin since this is a Google POJO and I cannot modify properties directly, but wasn’t able to resolve the problem. Any help regarding this would be greatly appreciated! Thanks.

The complete test code is:

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.testng.annotations.Test;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.api.services.androidmanagement.v1.model.Device;
import com.google.api.services.androidmanagement.v1.model.HardwareInfo;
import com.google.api.services.androidmanagement.v1.model.MemoryInfo;
import com.google.api.services.androidmanagement.v1.model.SoftwareInfo;
import com.google.common.collect.ImmutableMap;

/**
 * TODO: Document this class.
 */
public class DeviceTest {


    @Test
    public void myTest() {

        // code to build the test Device object 
        Device device = new Device();
        final List<String> prevNameList = Arrays.asList("prev-1", "prev-2", "prev-3");

        final HardwareInfo hwInfo = new HardwareInfo();
        hwInfo.setBrand("hwinfo-brand");
        hwInfo.setDeviceBasebandVersion("hwinfo-baseband-version");
        hwInfo.setManufacturer("test-manufacturer");
        hwInfo.setModel("hwinfo-model");
        hwInfo.setSerialNumber("hwinfo-serial-no");
        hwInfo.setHardware("hwinfo-hardware");

        final MemoryInfo memoryInfo = new MemoryInfo();
        memoryInfo.setTotalInternalStorage(123456789L);
        memoryInfo.setTotalRam(123456789L);

        final Map<String, String> propsMap = ImmutableMap.of(
                "prop1", "x86",
                "prop2", "ARM",
                "prop3", "Intel Itanium-based");

        device.setPolicyName("test-policy-name");
        device.setAppliedPolicyName("test-applied-policy-name");
        device.setEnrollmentTokenName("test-enrollment-token-name");
        device.setEnrollmentTokenData("test-enrollment-token-data");
        device.setEnrollmentTime("2020-01-01T00:00:00.000Z");
        device.setLastPolicySyncTime("2020-01-01T00:00:00.000Z");
        device.setLastStatusReportTime("2020-01-01T00:00:00.000Z");
        device.setLastPolicyComplianceReportTime("2020-01-01T00:00:00.000Z");
        device.setUserName("test-user-name");
        device.setName("test-name");

        device.setPreviousDeviceNames(prevNameList);
        device.setSystemProperties(propsMap);
        device.setHardwareInfo(hwInfo);
        device.setMemoryInfo(memoryInfo);

        ObjectMapper mapper = buildMapper();
        try {
            // code to convert object to JSON
            final String json = mapper.writeValueAsString(device);
            final String jsonHwInfo = mapper.writeValueAsString(device);
            System.out.println(json);

            // code to read JSON to object
            final Device deserializedDevice = mapper.readValue(json, Device.class);
            System.out.println(deserializedDevice);
        } catch (IOException | JsonProcessingException e) {
            e.print
        }
    }

    private static ObjectMapper buildMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);

        return mapper;
    }

}

The output for this test is:

{"appliedPolicyName":"test-applied-policy-name","enrollmentTime":"2020-01-01T00:00:00.000Z","enrollmentTokenData":"test-enrollment-token-data","enrollmentTokenName":"test-enrollment-token-name","hardwareInfo":{"brand":"hwinfo-brand","deviceBasebandVersion":"hwinfo-baseband-version","hardware":"hwinfo-hardware","manufacturer":"test-manufacturer","model":"hwinfo-model","serialNumber":"hwinfo-serial-no"},"lastPolicyComplianceReportTime":"2020-01-01T00:00:00.000Z","lastPolicySyncTime":"2020-01-01T00:00:00.000Z","lastStatusReportTime":"2020-01-01T00:00:00.000Z","memoryInfo":{"totalInternalStorage":123456789,"totalRam":123456789},"name":"test-name","policyName":"test-policy-name","previousDeviceNames":("prev-1","prev-2","prev-3"),"systemProperties":{"prop1":"x86","prop2":"ARM","prop3":"Intel Itanium-based"},"userName":"test-user-name"}
com.fasterxml.jackson.databind.JsonMappingException: Can not set com.google.api.services.androidmanagement.v1.model.HardwareInfo field com.google.api.services.androidmanagement.v1.model.Device.hardwareInfo to java.util.LinkedHashMap (through reference chain: com.google.api.services.androidmanagement.v1.model.Device("hardwareInfo"))
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:353)
    at com.fasterxml.jackson.databind.deser.std.ContainerDeserializerBase.wrapAndThrow(ContainerDeserializerBase.java:181)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:539)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3188)
    at com.mobileiron.polaris.service.androidwork.androidmanagementapi.DeviceTest.myTest(DeviceTest.java:89)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:756)
    at org.testng.TestRunner.run(TestRunner.java:610)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
    at org.testng.TestNG.runSuites(TestNG.java:1133)
    at org.testng.TestNG.run(TestNG.java:1104)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:110)
Caused by: java.lang.IllegalArgumentException: Can not set com.google.api.services.androidmanagement.v1.model.HardwareInfo field com.google.api.services.androidmanagement.v1.model.Device.hardwareInfo to java.util.LinkedHashMap
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
    at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
    at java.lang.reflect.Field.set(Field.java:764)
    at com.google.api.client.util.FieldInfo.setFieldValue(FieldInfo.java:245)
    at com.google.api.client.util.FieldInfo.setValue(FieldInfo.java:206)
    at com.google.api.client.util.GenericData.put(GenericData.java:103)
    at com.google.api.client.util.GenericData.put(GenericData.java:47)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:534)
    ... 30 more

Utilizando um arquivo Json para estilizar o React

Olá, boa noite. Estava estudando sobre estilização de componentes no React e achei
um site bem interessante para isso

Neste site escolhemos a paleta de cores e depois baixamos um arquivo JSON, porém ele não é muito claro de como utilizar este arquivo JSON que baoixei. Gostaria da ajuda de vocês, pois estou iniciando no React, talvez seja uma pergunta boba, porém não consigo encontrar a resposta.

No GitHub do site tem a seguinte explicação:

“So now, give this website to your designer, and wait for him to give
you the theme file. And then, to integrate it, you just have to do the
following”

import React from 'react';
import ReactDOM from 'react-dom';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import Application from './your/entry/point';
import yourRawTheme from './wherever/is/your/theme.json';

const theme = createMuiTheme(yourRawTheme);

ReactDOM.render(
  <MuiThemeProvider theme={theme}>
    <Application />
  </MuiThemeProvider>
, document.getElementById('root'));

Minha dúvida é:
Devo criar um novo arquivo com o código descrito acima? Se sim, qual nome devo dar, chamo o App dentro dele? Como fica a hierarquia de componentes?

Eu tentei da seguinte maneira, salvei o arquivo que veio do site como tema.json e fiz um arquivo próprio para o código acima.
Como ficou a pasta src do React

Tirei um print também de como ficou o código no arquivo Theme.js e como veio o código no arquivo json.
Arquivo com o código da explicação fornecida no GitHub
Arquivo que JSON que foi gerado pelo site

Obrigada!!