• 🔥 Бесплатный курс от Академии Кодебай: «Анализ защищенности веб-приложений»

    🛡 Научитесь находить и использовать уязвимости веб-приложений.
    🧠 Изучите SQLi, XSS, CSRF, IDOR и другие типовые атаки на практике.
    🧪 Погрузитесь в реальные лаборатории и взломайте свой первый сайт!
    🚀 Подходит новичкам — никаких сложных предварительных знаний не требуется.

    Доступ открыт прямо сейчас Записаться бесплатно

How to I make use of an API return from a GET post?

10.09.2024
5
0
I will post this first in English. I have this API request that is a GET request and it returns a massive JSON text. So, what is the easiest way to make the JSON file properly formatted and usable?
This is what the code looks like, by the way, that gets the massive text return.

Shall I repost this in Russian?

code-that-works.png
 
C#:
using System;
using System.IO;
using System.Text.Json;

  string jsonString = "{\"name\":\"John\",\"age\":30,\"cars\":[\"Ford\",\"BMW\",\"Fiat\"]}"; // JSON DATA

        using (JsonDocument document = JsonDocument.Parse(jsonString))
        {
            string formattedJson = JsonSerializer.Serialize(document, new JsonSerializerOptions
            {
                WriteIndented = true
            });

            string filePath = "output.json";

            File.WriteAllText(filePath, formattedJson);

            Console.WriteLine("JSON saved to file: " + filePath);
        }
 
  • Нравится
Реакции: William Thompson
Мы в соцсетях:

Взломай свой первый сервер и прокачай скилл — Начни игру на HackerLab