0

I am having problem with my NFT JSON files. Because of lack of facilities I have generated my 10k NFT collection as 10*1000, now I have ten collections (each 1000) instead of a single collection (of 10000). The JSON objects of each collection are numbered from 1-1000. But I want to copy all JSON objects into a single file and update their "edition" numbers in sequence from 1-10000. Thanks in advance. Here is the NFT metadata code.

  "file_path": "ipfs://NewUriToReplace/1.png",
  "nft_name": "NFT #1",
  "external_link": "",
  "description": "NFT Description",
  "collection": "Collection Name",
  "properties": [
    {
      "type": "type",
      "name": "name"
    },
    {
      "type": "type",
      "name": "name"
    },
    {
      "type": "type",
      "name": "name"
    },
    {
      "type": "type",
      "name": "name"
    },
    {
      "type": "type",
      "name": "name"
    }
  ],
  "levels": [],
  "stats": [],
  "unlockable_content": [],
  "explicit_and_sensitive_content": false,
  "supply": 1,
  "blockchain": "Polygon",
  "price": 0.005,
  "quantity": 1,
  "dna": "a2fc94a3a51a7c853c01b553019628907f437d2a",
  "edition": 1,
  "date": 1642499902138,
  "creator": "Artist",
  "seller_fee_basis_points": 250,
  "address": "0x2c41a4e7d9321b1134b076bb0be866709fda6ffb",
  "share": 100,
  "Date": "January 2022",
  "compiler": "HashLips Art Engine"
}```

2 Answers2

0

You coud, for instance, use php where you have to read each file, append it to an array, edit the array then dump it to a file:

simple php code to deal with json

$arr = [];
//scroll trough files (you can use libraries to better do this)
for($i=0; $i<100; ++i)
    array_push($arr, json_decode(file_get_contents("file$i.json"),true) );

//here $arr contains all the 100 jsons, you can access it as a normal associative array and you can
//do your stuff
$arr[100]['esition'] = 'my_edition';

//dump the associative array as to a single file formatted as json
file_put_contents("outfile.json",json_encode($arr));
DDS
  • 2,340
  • 16
  • 34
  • Thanks for your response, but I am no coder or programmer anyway. I can not understand this. May be I want a solution like this [https://stackoverflow.com/questions/13933944/rename-multiple-files-without-parentheses-remove-parentheses-windows] provided by SlayerCat which helped me removing file name brackets. But unlike that in this case all my json objects are in one file and one thing needs to be updated in sequence in every object, the edition number. – Hameed Albaloshi Jan 18 '22 at 13:04
  • I think that if you're not a software developer StackOverflow isn't the most adequate place where you can find answers – DDS Jan 18 '22 at 15:26
  • Thanks for informing! I will try my best to rename them manually. – Hameed Albaloshi Jan 18 '22 at 15:59
0

Found the solution through the HashLips art engine's main.js settings. If you want to generate your nft collection not in one step, but rather in many steps, for example 10*1000 instead of 10000. Make these on the HashLips Art Engine's main.js file's this part. In the third and seventh lines of this code replace 1 with starting number you want to start generating from. Here you can see I have replaced the 1s with 1001, so generation starts from 1001, not 1.

  let layerConfigIndex = 0;
  let editionCount = 1001;
  let failedCount = 0;
  let abstractedIndexes = [];
  for (
    let i = network == NETWORK.sol ? 0 : 1001;
    i <= layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo;
    i++
  ) {
    abstractedIndexes.push(i);
  }```
Hameed
  • 1